Tech Support > Microsoft Windows > Drivers > ReadPrinter fails for TCP/IP port, works for LPT1 and USB using pjlmon XP DDK sample
ReadPrinter fails for TCP/IP port, works for LPT1 and USB using pjlmon XP DDK sample
Posted by Starman on January 6th, 2005


Hi all,
I have this problem which has been eluding me for weeks. The sample
pjlmon project that comes with the XP DDK works perfectly for printers
that are connected via LPT and USB, but fails when trying to read from
a printer that's connected via TCP/IP. The printer port we're using is
a Standard TCP/IP port, over port 9100 which creates a port named
IP_10.32.56.23 which is fine.

Here's the kicker - when I use WritePrinter to send the data down,
WritePrinter works and returns back a successful value. Using the
Ethereal packet sniffer, I find that we DO get the right data back from
the printer, but for some reason it doesn't "bubble up" from the port
to the language monitor, and ReadPrinter returns with a 0 meaning that
no data was read back, and the buffer's empty. I don't know where the
data's getting blocked. Is the port monitor blocking it from the
language monitor?

I've tried this with both the outdated versions of pjlmon and the
newer updated one (InitializePrintMonitor and InitializePrintMonitor2).
Doing some digging, I found that the port type you're using uses a
different DLL for filling in the MONITOR/MONITOR2 structure. Using a
debugger, I found that for TCP/IP, GetPrinterDataFromPort is NULL for
TCP printers, and valid for LPT and USB. It seems to me that the
tcpmon.dll DLL assumes that backchannel data will never come from a
TCP/IP printer. If this is true, I'm going to have to work out my own
solution since I can't depend on that DLL for reading data back. In
fact, I already did that, but it bypasses ReadPrinter which I really
don't feel comfortable doing.

According to the MSDN documentation, using SendRecvBidiDataFromPort
only works on Windows XP anyway, so that solution will not be an option
since we have to support 9x->XP.

So, what I want to know, if anyone can answer, are the answers to
these questions:

1) Why do we not get backchannel data back from a printer with pjlmon
(both old and new) using TCP/IP, but works with LPT and USB?

2) Will bidi communication work on server-based system such as CUPS and
Samba? HP's bidi software wouldn't work with printers connected to
these types of systems, but did work with direct TCP/IP connections.
Thanks in advance.
Mike

Posted by Marc Reinig on January 6th, 2005


Firewall?

Marco
________________________
Marc Reinig
UCO/Lick Observatory
Laboratory for Adaptive Optics

"Starman" <starmannj@hotmail.com> wrote in message
news:1105027097.899990.77120@c13g2000cwb.googlegro ups.com...


Posted by Starman on January 6th, 2005


Good idea, but other custom bidi drivers work fine. Those drivers DON'T use
the Windows API which leads me to believe that it either can't be done via
ReadPrinter, or it's broken (or else, why would other companies write their
own solution?).

Mike

"Marc Reinig" <Marco@newsgroups.nospam> wrote in message
news:ubxmVnB9EHA.3676@TK2MSFTNGP10.phx.gbl...



Similar Posts