TCP-connection/Timout
See original GitHub issueWhen connecting over TCP, the printer closes the connection after 90 seconds inactivity with the reset flag. (Observed with Wireshark on my EPSON TM20II i use for my tests).
this cause that in BasePrinter -> Read() -> ReadByte();
throws an System.IO,IOException each 100ms (as you catch the exception with Thread.Sleep(100)
)
also Write() will throw the same exception.
here some logic is needed to check if the connection is lost. I have done some tests in my forked branch bug/connection : e.g. the connection can be checked as described here: https://stackoverflow.com/a/14925438/12648992 with a method for the network-Printer e.g.:
public override bool IsConnected()
{
return !((_socket.Poll(1000, SelectMode.SelectRead) && (_socket.Available == 0)) || !_socket.Connected);
}
also the System.IO.IOException
exception of BasePrinters Read()
might be handled as lost connection.
however with my changes i can only handle the dropped connection by the printer. handle issues with the network like unplug eth-cable on the printer or restart raises additional issues (TCP-connection stayes open while the printer is gone)
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
@oachkatzalschwoaf @kodejack thanks for coordinating this, I really appreciate it! I don’t have a network printer so I’m glad you all were able to get this fixed and merged in.
fixed in master