question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TCP-connection/Timout

See original GitHub issue

When 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:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
lukevpcommented, Feb 11, 2020

@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.

0reactions
oachkatzalschwoafcommented, Feb 10, 2020

fixed in master

Read more comments on GitHub >

github_iconTop Results From Across the Web

TCP Socket no connection timeout
The default value is 15, which corresponds to a duration of approximately between 13 to 30 minutes, depending on the retransmission timeout. The ......
Read more >
What is a TCP connection timeout?
Abstract The TCP user timeout controls how long transmitted data may remain unacknowledged before a connection is forcefully closed. It is a local, ......
Read more >
Which is the default TCP connect timeout in Windows?
Usually "connect timeout" refers to the timeout for creating the initial connection to a host. In many systems (Windows 7 included), ...
Read more >
Understanding Idle Timeout and Keep Alive Interval ...
The Idle Timeout setting in the TCP profile specifies the length of time that a connection is idle before the connection is eligible...
Read more >
TCP/IP settings
Sets the initial timeout value for a TCP connection. This value is defined in half second ( 1/2 ) unit, and defaults to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found