I have an HP Officejet 4500 G510n-z printer/scanner, connected to the local wifi. I'm trying to scan from my macbook running OS X Yosemite (10.10.5), but when I try to do so, I get the error message "Failed to open a session on the device". This has worked before, with the same computer and scanner, so I'm trying to figure out what has changed, and how to fix it.

In Preview, the File menu has an "Import from Officejet 4500 G510n-z" entry, which suggests that it recognises that this is a scanner. Selecting that menu entry gives the above error message. I get the same result when using the "Open Scanner" button in "System Preferences" -> "Printers & Scanners".

I can access the HTTP interface of the device, which only shows information related to the printer part of it and the network configuration.

Printing works fine. Looking at the network traffic with Wireshark, this generates a lot of traffic on port 9100, as expected.

When I try to scan something, as above, the computer sends a TCP SYN packet to port 9500 on the device, which gets an immediate RST response:

No.     Abs Time           Time           Source                SPort  Destination           DPort  Protocol Info                                                            Host       seq        len        src addr unresolved
   5596 22:20:10.401777    368.249752          50100         9500   TCP      50100 → 9500 [SYN] Seq=0 Win=65535 Len=0 MSS=1460 WS=32 TSval=20957697 TSecr=0 SACK_PERM=1            0          0
   5597 22:20:10.406550    368.254525         9500          50100  TCP      9500 → 50100 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0                          1          0

Still it takes a few seconds for the error message to show up in the user interface. Unfortunately I don't have a packet capture from the device when it's working properly.

Googling this error message suggested resetting the printer drivers and restarting the computer, which didn't help.

What can I do to debug this further and/or fix it?

Update: HP support suggested using the "HP Print and Scan Doctor" available on their website.

I tried running it under Wine on my Macbook, but it crashed before discovering the printer.

Having found an actual Windows machine, I tried running the tool again, but it didn't discover the printer. I had to install the driver (in "Printers and scanners", click "Add printer") in order for the tool to discover the printer.

With the driver installed, the "doctor" said that the complete software for the printer was not installed, and provided a button for downloading and installing the software.

With the "complete software" installed, the "doctor" showed a button labelled "Fix scanning". It ran a list of tests, not finding any problems. A test scan also worked well, and the Windows scan utility was also able to scan — but my Macbook still couldn't. Wireshark revealed that the Windows computer communicated with the scanner on port 9290 instead of port 9500. I'm not sure if OS X could be persuaded to do likewise.


I had this issue on a Samsung MFP Printer. It was working then it stopped and I scratched my head for a few months figuring it out. The solution: (re-)enable T4NET protocol on port 9400 on the printer. Mac OSX is using it for the twain drivers.

  • 1
    Can you explain more to Help Op? – yass Apr 9 '17 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.