Re: long lasting client socket connection



On 2012-01-12, Bill M <wpmccormick@xxxxxxxxxxxxxxxxxxxxxxxxx> 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?

Yes, the Null Node Pattern: when you don't want something to happen
(like closing and re-opening), then omit the lines of code that would cause
that to happen.

:)

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.

So you might want to include in your design the provision for keepalive
ping messages (in either direction: server or client initiated).

You probably need some kind of layered design: some objects representing the
server session, which hides a protocol for exchanging multiple messages with
the server within one session.

That layer can hide the connecting and re-connecting from the higher
application layers.
.



Relevant Pages

  • Re: object oriented parsing
    ... expression by using above design pattern. ... Expression evaluation is usually at a much lower level of abstraction than the overall problem so it would usually be encapsulated in a single method. ... This is analogous to trying to code a Quicksort algorithm using OO techniques; one might be able to identify object like Pivot and Partition, but OO techniques would be overkill for such a low-level problem and one would usually encapsulate it in a sortIt library function that one calls from a method. ... Design patterns are not an end in themselves and they are not intended to be some cookbook tool for mechanically designing software. ...
    (comp.object)
  • Re: Exchange 2007 and Hyper-V question
    ... I'm finalizing a design for a client that wants a 5,000 user Exchange 2007 ... I understand that E2K7 is supported in Hyper-V, with the exception of the UM ... Install Hyper-V on the server as well as the UM role. ... You would then be able to use three mailbox servers as ...
    (microsoft.public.exchange.design)
  • User autentification and access to "sister" domain resources
    ... I am in process of designing brand new AD structure for our customer. ... 2003 Servers - pretty classic design ... All DCs are Global Catalogs. ... user_from_domainA gets IP address from siteB DHCP server ...
    (microsoft.public.win2000.active_directory)
  • Re: Turn out the lights
    ... If it was plain HTML generated on server, I don't think it would take more than half of second to load a page like this. ... Maybe you're picking on Microsoft because you're dissatisfied with qooxlisp performance? ... Typically design process looks like this: graphic designers make designs in Photoshop, then HTML/CSS specialists make HTML/CSS from graphic design. ... It is bad both because of delay and weirdness -- blank page instantly produces reacion "WTF went wrong?". ...
    (comp.lang.lisp)
  • Re: Using SQl to store aspx pages and memory problems
    ... The solution I was looking at would be to create some specific server side ... I want the data to be saved in the page so I thought that a asp.net control ... the original design and one that ensures that future system changes will not ... > database isn't some sort of magic pixie dust that solves all problems. ...
    (microsoft.public.dotnet.framework.aspnet)