Reputation: 70466
With the Virtual Serial Ports Emulator I can
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?
Upvotes: 0
Views: 3192
Reputation: 4849
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>')
Upvotes: 2