Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: wonderfulll on June 09, 2010, 05:19:35 AM

Title: Redirect TCP to parallel port
Post by: wonderfulll on June 09, 2010, 05:19:35 AM
Is there any way to redirect data from tcp port to parallel port?
Title: Re: Redirect TCP to parallel port
Post by: bmarkus on June 09, 2010, 05:25:14 AM
Is there any way to redirect data from tcp port to parallel port?

For what purpose?
Title: Re: Redirect TCP to parallel port
Post by: curaga on June 09, 2010, 05:51:30 AM
I've done that ;)

I had a laplink connection to an older laptop, and NAT'ed internet through that. Is this what you mean?

If not, for raw redirection you can use bash or netcat (can't remember the syntax for either, but something like ncat tcp:444 > /dev/lp0/parport0)
Title: Re: Redirect TCP to parallel port
Post by: wonderfulll on June 09, 2010, 09:07:11 AM
Is there any way to redirect data from tcp port to parallel port?

For what purpose?

to send data to thermal printer
Title: Re: Redirect TCP to parallel port
Post by: danielibarnes on June 09, 2010, 12:00:27 PM
Tiny Core has the socat.tcz extension which will probably work. There is a man page (http://www.dest-unreach.org/socat/doc/socat.html) with more information. In your case, this should work:
sudo modprobe lp
socat -u TCP4-LISTEN:44444,reuseaddr,fork OPEN:/dev/lp0

If you are sending binary data (rather than just text) to the printer, you will need raw access to the parallel port via /dev/parport0. This driver is not part of the base (http://forum.tinycorelinux.net/index.php?topic=5723.msg30437#msg30437), so you must compile the ppdev module yourself from the Linux kernel source. Perhaps we need a ppdev.tcz extension. :)
Title: Re: Redirect TCP to parallel port
Post by: curaga on June 09, 2010, 01:05:32 PM
If you are sending binary data (rather than just text) to the printer, you will need raw access to the parallel port via /dev/parport0. This driver is not part of the base (http://forum.tinycorelinux.net/index.php?topic=5723.msg30437#msg30437), so you must compile the ppdev module yourself from the Linux kernel source. Perhaps we need a ppdev.tcz extension. :)

It is in 3.x.