Bidirectional communication between two serial devices over TCP/IP
This article contains step-by-step instructions on how to set up bidirectional communication between two serial RS232 devices over TCP/IP.
You will need:
- Two RUT955 devices with Public IP
- Two end devices (PCs or RS232 devices able to send and receive data, here we will be using PCs with serial simulators)
End devices are connected to separate RUT955 routers through RS232 connection, and routers communicate to each other through ISP with Public IPs.
RUT955 configurations[edit source]
To achieve communication between your devices, which are connected to routers through serial port, apply this configuration. In this example RS232 will act as both, Master and Slave. Configuration on both devices is almost identical except Client and Server part, where they are reversed. In order to find these settings in routers WebUI go to Services > RS232/RS485 > RS232
- Enable Serial port
- Configure Serial port in accordance to connected device, these should match on both routers to avoid miscommunication
- Serial Type must be Over IP and protocol must match either TCP or UDP
- Mode Bidirect – lets device act as both Server and a Client
- Server address is other routers IP, in this example we are using Public IPs, it also works with Private IPs if routers are in same LAN
- Port used by Router1 to connect to server will be used as TCP port for Router2 and vice versa
- TCP port used by Router1 will be used by Router2 to connect to server and vice versa.
Add allowed interfaces[edit source]
After finishing serial port configuration add interfaces through which routers will be communicating, You can add IP address that will be allowed to connect or enter 0.0.0.0 to allow all connections coming through correct port.
Testing configuration[edit source]
If you followed configuration steps both end devices should be able to send and receive data from each other. In this example we use Hercules program on both computers and open serial communication with routers. Both of them are able to send and receive data through RS232 from other device.