🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #1950

Re: Restart connection

#1950
From: Remy Lebeau (TeamB)
Date: Mon, 18 Sep 2006 06:31
26 lines
2108 bytes
"Ofer Gaatone" <ofer@roseman.co.il> wrote in message 
news:450d3815$1@newsgroups.borland.com...

> How can the client identify that the server crushed ?

The socket will report an error whenever you tr to read/write on the invalid 
connection.

> How come there is no error when sending a message on a socket
> when there is no server to answer ?

There is.  However, abnormal disconnects are very difficult to detect in a 
timely manner.  It may take several hours for the OS to detect that a socket 
connection has been lost.  In the meantime, the socket happily continues 
accepting read/write requests.  The reads will return no data, and the 
writes will be buffered and never sent.  As such, you should be implementing 
your own timeouts in your code, and also implemennting keepalives into your 
data protocol if possible.  Have the client send a keepalive packet 
periodically, and have the server reply to it.  If the client does not 
receive a reply, then close the connection and reconnect.  If the server 
does not receive any data from a client for a period of time, then close the 
connection and wait for a new connection.


Gambit 
Technical Details
Message-ID: <450e4114$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <450d3815$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,e2087e2964f694e4
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <450d3815$1@newsgroups.borland.com>
Subject: Re: Restart connection
Date: Sun, 17 Sep 2006 23:31:39 -0700
Lines: 28
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 69.169.4.232
Message-ID: <450e4114$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1158562068 69.169.4.232 (17 Sep 2006 23:47:48 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail