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.
parameters: TCP port, serial port device file, baudrate
very extensively commented (large parts from tutorials)
free (as in beer and as defined by RMS)
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
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.