๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #8269

Re: socket disconnect detection.

#8269
From: Remy Lebeau (TeamB)
Date: Mon, 08 Nov 2004 23:32
27 lines
1739 bytes
"Johan Elms๏ฟฝter" <johan.elmsater@bulletinboard.nu> wrote in message
news:418ff5e3@newsgroups.borland.com...

> I have been trying to find a smooth way to see if a socket disconnected.

The subject of many discussions.  There is no simple single way to do that.

> for example if is use "recv" socket call it will return SOCKET_ERROR
> if the connection was not gracefully shutdown, but if it was
> gracefully shutdown, it will only return zero.

You did not mention whether you are using blocking or non-blocking sockets.
It makes a difference.

> I have tried lot's of things but I can't find anyway to do this except
> from using a "timer" and timeout the connection if no data has been
> received in a specific time.

That is the common approach to the issue.

> but that is not a solution for me.

Why not?


Gambit
Technical Details
Message-ID: <419001bd$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!newsfeed.icl.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <418ff5e3@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6ce82371864e0ae4
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <418ff5e3@newsgroups.borland.com>
Subject: Re: socket disconnect detection.
Date: Mon, 8 Nov 2004 15:32:36 -0800
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <419001bd$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1099956669 68.69.17.41 (8 Nov 2004 15:31:09 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!newsfeed.icl.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail