Create a virtual serial port connection over TCP
Try socat. Possible scenario:
socat pty,link=/dev/virtualcom0,raw tcp:192.168.254.254:8080&
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.
Virtual Serial Port on linux through TCP
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>')
Can I use a serial port as TCP/IP interface on Red Hat Linux?
You should also be able to use PPP (point-to-point protocol) to another endpoint over a serial connection.
Linux command to send data to a remote tcp-client
Install netcat
yum install nc
Make it to listen to a particular port number
nc –l portnumber &
Lets validate it using netstat from a different console:
netstat -anlp |grep yourportnumber
PS: Change the installation command based on your linux flavor.
xml messaging over serial port
The serial port is just the transport you have available. You can theoretically run just about any protocol over serial port that you could run over other communication means. Theoretically you could even run TCP/IP over bongo drums.
If the embedded device supports it, you can run TCP/IP over the serial port, and pass your XML structure over TCP/IP based protocols.
Converting serial port data to TCP/IP in a linux environment
Even if the embedded device cannot run a protocol like TCP/IP, you can still transmit XML messages over the serial port and interpret them in your C program.
Related Topics
How to Search Contents of Multiple PDF Files
Creating Temporary Files in Bash
Grep Inside All Files Created Within Date Range
Linux Removing Folders Older Than 1 Year and More Than 3 Files
Should I Use Libc++ or Libstdc++
How to Set Cron to Display Gui Application
How Would I Get a Cron Job to Run Every 30 Minutes
Uevent Sent from Kernel to User Space (Udev)
Run Shell Command in Jenkins as Root User
How Is the Linux Kernel Tested
Identify User in a Bash Script Called by Sudo
Pthread Mutex Lock Unlock by Different Threads
Bash Command Substitution on Remote Host
Multiple Websites on Nginx & Sites-Available
How to Attach a File Using Mail Command on Linux
Writing a Putchar in Assembly for X86_64 with 64 Bit Linux
Apache Not Accepting Incoming Connections from Outside of Localhost