Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > ReadPrinter fails for TCP/IP port, works for LPT1 and USB using pjlmon XP DDK sample

Reply
Thread Tools Display Modes

ReadPrinter fails for TCP/IP port, works for LPT1 and USB using pjlmon XP DDK sample

 
 
Starman
Guest
Posts: n/a

 
      01-06-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

 
Reply With Quote
 
 
 
 
Marc Reinig
Guest
Posts: n/a

 
      01-06-2005
Firewall?

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

"Starman" <> wrote in message
news: ups.com...
> 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
>



 
Reply With Quote
 
Starman
Guest
Posts: n/a

 
      01-06-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" <> wrote in message
news:...
> Firewall?
>
> Marco
> ________________________
> Marc Reinig
> UCO/Lick Observatory
> Laboratory for Adaptive Optics
>
> "Starman" <> wrote in message
> news: ups.com...
> > 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
> >

>
>



 
Reply With Quote
 
Junior Member
Join Date: Nov 2010
Posts: 3

 
      11-12-2010
Starman,

How did you make your own solution of bypassing ReadPrinter? I have been kicking this around for months trying to bypass ReadPrinter with no success.

I have tried everything I can think of from pfnReadPort to ReadPrinter and XcvDataPort.

I finally used a virtual serial port that connects to the printer over TCP but it means more programs. The monitor sees a Serial Port and pfnReadPort works.

Is there another function you use in MONITOR2? Do you directly access the TCP stream?
 
Reply With Quote
 
Junior Member
Join Date: Nov 2011
Posts: 1

 
      11-16-2011
Good morning,

I have the same problem. I'm developing a language monitor for a network printer. It works fine on serial, parallel and usb port, but on tcp i can send message (using pfnWritePort) but I can't read the response (with pfnReadPort) even if I am sure that printer send message (using a network sniffer).
It read your solution of creating virtual serial port. Did you use a free software to do this? Have you find another solution in this period? I think to develop a dll that creates a socket and use it for the communication between language monitor and printer.
Other ideas?
Thanks
val.net
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete LPT1 Parallel Port John Windows Vista Printing / Faxing / Scanning 5 10-24-2008 06:23 PM
LPT1 Port deleted from Device Manager dpower Windows Vista Hardware 5 05-17-2008 05:10 AM
SCSI mini port driver sample usage shakeel-ur-rehman Windows Vista Drivers 1 02-24-2004 08:51 PM
DHCP fails on virtual network adapter (netvmini DDK sample) [for MS] Windows Vista Drivers 0 01-28-2004 02:12 PM
isn't it a sample of virtual port? henry Windows Vista Drivers 1 10-23-2003 05:21 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59