FieldTalk™ Modbus Master .NET Library

MbusTcpMasterProtocol.setPort Method 

Sets the TCP port number of the Modbus slave device.

[Visual Basic]
Public Function setPort( _
   ByVal portNo As Short _
) As Integer
[C#]
public int setPort(
   short portNo
);

Parameters

portNo
Port number to be used when opening the connection

Return Value

BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors for possible error codes.

Remarks

Usually the port number remains unchanged and defaults to 502 for Modbus/TCP and 1100 for RTU over TCP. However if the port number has to be different this function must be called before opening the connection with openProtocol().

Note    A protocol must be closed in order to configure it.

See Also

MbusTcpMasterProtocol Class | FieldTalk Namespace