LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Serial data to IP packet conversion (https://www.linuxquestions.org/questions/linux-networking-3/serial-data-to-ip-packet-conversion-768472/)

raja7799 11-11-2009 01:10 PM

Serial data to IP packet conversion
 
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?

TB0ne 11-12-2009 08:22 AM

Quote:

Originally Posted by raja7799 (Post 3753232)
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.).

raja7799 11-14-2009 02:25 PM

Thanks for reply.
I'm using c language.
Actually i want to store the data what ever come from serial driver in a buffer. That data i have to send as ip packet. I had done with that.


All times are GMT -5. The time now is 02:43 AM.