[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determining whether a TCP connection is up

From: Julien Danjou
Subject: Re: Determining whether a TCP connection is up
Date: Mon, 05 Aug 2013 12:34:30 +0200
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

On Mon, Aug 05 2013, Lars Magne Ingebrigtsen wrote:

> Whether you have a pool of connections or kill/reconnect, the problem
> remains the same: Figuring out when to switch connections/reconnect.
> And in the case that the IP address changed, all your connections in the
> pool will hang, so it doesn't really help...

It would help a lot:
- connections would be stuck in the *background*, avoiding getting your
  Emacs frozen;
- connections will eventually time out (the kernel does have a TCP
  timeout), and you will be able to reschedule the operation since you
  used a queue.

Also, sqending regular NOOP command should triggers early detection of
IP changes. If I'm not mistaken, if the kernel thinks you have a TCP
session established, but your NATed public IP address changed, the
remote server is going to send you a RST or something like that as soon
as it received something, and the kernel will consider the connection as
no more valid and will close it.

That could even work for long operation:
- send a COMMAND that takes a lot of time
- change your public network IP address
- send a NOOP (seems you can do that, check
  -> if the remote server doesn't know your public IP address, the
     connection will be reset; restart!
  -> if the connection's good, the server might replies now, or later
     (see RFC)

My 2c,

Julien Danjou
;; Free Software hacker ; freelance consultant
;; http://julien.danjou.info

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]