Active4 months ago
I am developing an application that should be able to write to a virtual serial port and receive data through the same port from remote clients over network.
By employing software that enables sharing a serial port over Ethernet you can connect to COM devices that are located remotely. This same software lets you use COM ports on computers without a physical COM port by using serial port over LAN technology. Here are the TOP 5 serial over LAN solutions to create and use virtual COM ports anywhere. Serial to Ethernet Connector is a popular application for sharing virtual serial ports over Ethernet with an easy-to-use interface. This virtual serial over network software allows you to use up to 500 serial devices over Ethernet at a time. This way you can work with a device connected to a serial port from any remote location. Mapping COM Port-based Serial Applications Over Ethernet. Com Port Redirector (CPR) is software that maps ‘virtual COM’ ports on a PC platform. It redirects application data destined to an attached device via the PC’s local serial (COM) port. Rather than going out the local port, the data is transmitted across the Ethernet network using. Serial to Ethernet Connector perfectly connects a serial application via Ethernet to serial port on a remote machine thus allowing working with serial port over Ethernet, no matter how far away the needed application or serial device is. You will just need to establish client-server connection between the machines. Free Virtual Serial Ports is a Windows user-mode application, which allows you to create software virtual serial ports and emulate physical serial ports behavior. It operates exclusively in user-mode, therefore it is more stable and uses less memory, processor and operating system resources than any competitive products.
The application runs on a linux server. I am new in using serial ports and I have some questions on this topic.
Clients
The client can establish a TCP connection to a server. When we setup a client, we have to provide the IP address of the server, a tcp port (usually 8080) and a virtual com port.
The client then will automatically try to connect to the server.
Server
![Freeware Freeware](/uploads/1/2/6/2/126233057/128800222.jpg)
The server has a virtual com port, the same we set in the client config (e.g. COM1). When an application on the server writes data to this port, the data should be send to all clients connected via tcp. The response from the clients is send over TCP back to the server which can read it over the virtual serial port.
Question
On windows I used a virtual serial port connector http://www.eterlogic.com/Products.VSPE.html which did most of the work. However I want to solve this problem on linux machines.
My question is, how can I create a TCP server that has a virtual serial port attached and can send/receive data through this port over TCP to listening clients?
user207421270k2828 gold badges231231 silver badges386386 bronze badges
UpvoteUpvoteVirtual Serial Port Over Ethernet Switch
37.6k115115 gold badges327327 silver badges548548 bronze badges
2 Answers
Try socat. Possible scenario:
socat creates TCP connection to 192.168.254.254:8080, so that everything, that will be written to /dev/virtualcom0 will be forwarded to 192.168.254.254:8080 and vice versa.
Another approach would be to use RFC2217 via ser2net on Linux sever side and RFC2217 driver on Windows side (for example http://www.hw-group.com/products/hw_vsp/index_en.html single port version). You can also try to get http://pyserial.sourceforge.net/ to work with ser2net.
yegorichyegorich3,66422 gold badges2222 silver badges3232 bronze badges
The software will help to establish server and client connection over TCP http://www.serial-com-port.com/
I use it for creating virtual serial communications over network, but I have the real RS232 port on the computer. So I just transfer the data over network. If you need to create a virtual COM on the server too, use the Virtual Serial Port Driver.
Jenny BredstJenny Bredst