WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Redirect TCP to parallel port  (Read 3297 times)

Offline wonderfulll

  • Newbie
  • *
  • Posts: 11
Redirect TCP to parallel port
« on: June 09, 2010, 05:19:35 AM »
Is there any way to redirect data from tcp port to parallel port?

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Redirect TCP to parallel port
« Reply #1 on: June 09, 2010, 05:25:14 AM »
Is there any way to redirect data from tcp port to parallel port?

For what purpose?
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Redirect TCP to parallel port
« Reply #2 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)
The only barriers that can stop you are the ones you create yourself.

Offline wonderfulll

  • Newbie
  • *
  • Posts: 11
Re: Redirect TCP to parallel port
« Reply #3 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

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: Redirect TCP to parallel port
« Reply #4 on: June 09, 2010, 12:00:27 PM »
Tiny Core has the socat.tcz extension which will probably work. There is a man page 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, so you must compile the ppdev module yourself from the Linux kernel source. Perhaps we need a ppdev.tcz extension. :)

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Redirect TCP to parallel port
« Reply #5 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, 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.
The only barriers that can stop you are the ones you create yourself.