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