serial-to-tcp-socket bridge

There is a better solution than mine: ser2net. Google it.

WARNING: the current code contains a small bug which limits the length of a line transmitted via RS-232.

While working on my diploma thesis I have written a simple tool that gets the data from a serial port and outputs it via a TCP socket. I haven't found anything like this on the web.

What's nice:
parameters: TCP port, serial port device file, baudrate
very extensively commented (large parts from tutorials)
free (as in beer and as defined by RMS)

What's ugly:
Only works under Linux
not the smallest one (9 kb source, 14 kb binary)
probably some small bugs
only one-way (yet) – no socket-to-serial functionality

If you find a use for it – here it is:
Source: capboard_bridge.c
Binary: capboard_bridge

Please build the tool from source – it's inherently safer – and you can learn about serial and TCP socket programming.
Just download the source file and execute

 gcc -o capboard_bridge capboard_bridge.c 

to compile it.

BTW: it's named 'capboard_bridge' because I use it for interfacing a custom circuit board (capboard) with a USART and a Java analyzer app.

Previous Post
Leave a comment


  1. anonymous

     /  December 1, 2007

    jhoger writes:socat is good for this kind of thing.

  2. anonymous

     /  February 3, 2010

    Anonymous writes:Hey! Nice work!!! I am working on a project that needs this functionality, but both ways. From the socket back to the serial port as well…

  3. anonymous

     /  October 27, 2010

    Danny writes:thanks for your sharing~ I find it very useful

  4. anonymous

     /  October 10, 2011

    iphone 4 cases writes:thank you,iphone 4 case


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: