Menu

Code Example Modbus Server

package run;
import de.re.easymodbus.server.*;

public class run {
    public static void main(String[] args)
    {
        ModbusServer modbusServer = new ModbusServer();
        modbusServer.setPort(1522);//Note that Standard Port for Modbus TCP communication is 502
        modbusServer.coils[1] = true;
        modbusServer.holdingRegisters[1] = 1234;
        try
        {
            modbusServer.Listen();
        }
        catch (java.io.IOException | Exceptions.ModbusException e)
        {           
        }
    }
}

Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.