WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline wonderfulll

  • Newbie
  • *
  • Posts: 11
Redirect TCP to parallel port
« on: June 09, 2010, 02: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, 02: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: 10969
Re: Redirect TCP to parallel port
« Reply #2 on: June 09, 2010, 02: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, 06: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, 09:00:27 AM »
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: 10969
Re: Redirect TCP to parallel port
« Reply #5 on: June 09, 2010, 10:05:32 AM »
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.