Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.development.apps > #390

Re: long lasting client socket connection

From Rainer Weikusat <rweikusat@mssgmbh.com>
Newsgroups comp.os.linux.development.apps
Subject Re: long lasting client socket connection
Date 2012-01-13 14:54 +0000
Message-ID <87sjjjirem.fsf@sapphire.mobileactivedefense.com> (permalink)
References <jenlde$i5v$1@dont-email.me> <20120112141650.885@kylheku.com>

Show all headers | View raw


Kaz Kylheku <kaz@kylheku.com> writes:
> On 2012-01-12, Bill M <wpmccormick@just_about_everywhere.com> wrote:
>> I'm working on a socket client app that makes a connection to a server 
>> and leaves it open. Thinking that since he's repeatedly asking 
>> questions, there's little point in wasting time closing and reopening 
>> again. Are there any good design patterns out there for this I should 
>> take a look at?

[...]

> But seriously, noe thing you have to watch out for is keeping such connections
> idle for too long. It's almost impossible to avoid such an application being
> deployed by someone in a scenario where the client connets trhough one (or
> more) NAT gateways to the server. When these routers don't see any activity
> between a pair of destinations, they will expire the mapping entry, and then
> your connection is gone.

The same is true for any kind of stateful firewall even if NAT
isn't being used (and people use NAT quite mindlessly because "that's
how it is always being done). If you want to keep a TCP connection
open, you have to include application layer keepalives (preferably
using a randomized interval) and application-transparent (disconnect
and) reconnect (and restart sending of what was supposed to be sent
by the time the problem was detected[*].

[*] You only have to when you want this to work reliably. That's
something the guy who committed hibernate considered to be 'an
optional feature', consequently, his orm framework doesn't do that by
default but nobody ever didn't get a job with RedHat just because of
publishing 'designed by a retarded, typing monkey' open source
software ...

Back to comp.os.linux.development.apps | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

long lasting client socket connection Bill M <wpmccormick@just_about_everywhere.com> - 2012-01-12 16:04 -0600
  Re: long lasting client socket connection Kaz Kylheku <kaz@kylheku.com> - 2012-01-12 22:21 +0000
    Re: long lasting client socket connection Rainer Weikusat <rweikusat@mssgmbh.com> - 2012-01-13 14:54 +0000
      Re: long lasting client socket connection Bill M <wpmccormick@just_about_everywhere.com> - 2012-01-13 15:58 -0600
        Re: long lasting client socket connection Rainer Weikusat <rweikusat@mssgmbh.com> - 2012-01-13 22:17 +0000
          Re: long lasting client socket connection Bill M <wpmccormick@just_about_everywhere.com> - 2012-01-14 14:43 -0600
        Re: long lasting client socket connection Kaz Kylheku <kaz@kylheku.com> - 2012-01-13 22:38 +0000
          Re: long lasting client socket connection Rainer Weikusat <rweikusat@mssgmbh.com> - 2012-01-14 00:49 +0000

csiph-web