Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 800
  • Last Modified:

Trouble with OpenPrinter API and HP JetDirect 500X print server

I am trying to address each of the three separate ports on a HP JetDirect 500X print server using the OpenPrinter API (Private Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, ByVal pDefault As Long) As Long) The phPrinter variable keeps returning 0 which indicates an unsuccessful connection. I am passing the IP address of the print server to the pPrinterName parameter. Can anyone tell me what I am doing wrong?
0
gbzhhu
Asked:
gbzhhu
  • 2
1 Solution
 
BenBuckCommented:
I have had almost exactly the same problem. You can treat each port as an individual printer. The trick is to pass the port number along with the IP address when calling the API. Depending on the number of ports on the print server you need to add a number to the following connection string HTTP://xxx.xxx.xxx.xxx/ipp/port

i.e.

HTTP://xxx.xxx.xxx.xxx/ipp/port1 to access port number 1 or HTTP://xxx.xxx.xxx.xxx/ipp/port2 to access port number 2.

Hope this helps.
0
 
gbzhhuAuthor Commented:
I know our printer has 2 ports.  I will check this out

Thanks
0
 
gbzhhuAuthor Commented:
BenBuck

Thanks for that and contrary to my last post there are three ports (just a typo).  The API now works but only for two ports.  I expect it is either my syntax on port name or the port itself has a problem.  Either way I am happy to figure it out myself

Cheers for the quick solution
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now