Question

With the Virtual Serial Ports Emulator I can

  • Create a virtual serial port connector
  • Choose a port e.g. COM35 for the connector
  • Create TCP-Server
  • Assign the previously created virtual serial port to the server

enter image description here

Then clients can establish a stream connection to the tcp server by knowing the ip address, tcp port and the name of the virtual serial port.

In the above example I created an MICRO_Test application (c++) that simply connects to virtual serial port. When I write data to this port it will be received by all clients.

You can see it in the log in the image above.


While this is on windows, is there a way to achieve some equivalent behaviour on linux machines?

To sum up:

Some binary code (as interface for e.g. webservices)
                    |
                    |
                    | [send/receive via virtual com port]
                    |
                    |
TCP Server & COM connector (multiple instances possible with different ports)
       |          |          |
       |          |          |
       |          |          |
    Client 1   Client 2   Client X

The clients read physical data from their real com ports and send the data through the tcp stream to the server.

For linux I read a lot about socat, tty and ser2net. However I cannot get a real clue how to achieve an architecture like above on linux? Can you help me out with some information?

Was it helpful?

Solution

In theory you could use Python with PySerial package. It can handle COM ports, RFC2217 (ser2net) and TCP raw connections (socat).

For example you would start socat on all clients with real hardware and connect to them via Python script.

This statement opens raw socket:

tcp_con = serial.serial_for_url('socket://<my_ip>:<my_port>')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top