Quote:
Originally Posted by raja7799
Hi,
I have written a program which will read a serial data from RS232. I want prepare IP packet using this serial data. Can any body have any sort of program which will do Serial to IP conversion? Or do i need to prepare my self a IP packet using IPv4 header?
|
You don't say what version/distro of Linux, or even what language you're working in, so it's hard to give you any help at all. However, you don't need to write a program to do this in Linux. Just pipe the serial port through netcat.
Code:
netcat <address or hostname> <port to send to> < /dev/ttyS0
Just replace the address and port information. Also, you may be using a different serial port (i.e. change the /dev/ttyS0 part). You can use the stty or setserial commands to change the parameters of the serial port (baud rate, parity, stop bits, etc.).