🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: WSA????

#15943
From: Bob Gonder
Date: Wed, 04 Jun 2003 22:33
21 lines
2182 bytes
>"Tharun Pillay" <tharun@webmail.co.za> wrote in message
>
>> Trouble is that we don't know when the *server* must
>> close the connection - we are relying on a timout or the
>> client terminating the connection - which is dodgy.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/shutdown_2.asp
Also see ../closesocket_2.asp particularly about SO_DONTLINGER.  And
the link there to "(see Graceful shutdown, linger options, and socket
closure for more information)".

To assure that all data is sent and received on a connected socket
before it is closed, an application should use shutdown to close
connection before calling closesocket. For example, to initiate a
graceful disconnect:

1)Call WSAAsyncSelect to register for FD_CLOSE notification. 
2)Call shutdown with how=SD_SEND. 
3)When FD_CLOSE received, call recv until zero returned, or
SOCKET_ERROR. 
4)Call closesocket. 
Technical Details
Message-ID: <obssdvopq540mjv03irip73n9rmd9aes4k@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3edc7a5c@newsgroups.borland.com> <3edc7f28@newsgroups.borland.com> <3edcb8aa@newsgroups.borland.com> <3edccfa2$1@newsgroups.borland.com> <3eddb43a@newsgroups.borland.com> <3ede333d@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,30c81141f30ce678
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-06-04 15:34:58 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: WSA????
Date: Wed, 04 Jun 2003 15:33:01 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <obssdvopq540mjv03irip73n9rmd9aes4k@4ax.com>
References: <3edc7a5c@newsgroups.borland.com> <3edc7f28@newsgroups.borland.com> <3edcb8aa@newsgroups.borland.com> <3edccfa2$1@newsgroups.borland.com> <3eddb43a@newsgroups.borland.com> <3ede333d@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.31.166.37
X-Trace: newsgroups.borland.com 1054765975 67.31.166.37 (4 Jun 2003 15:32:55 -0700)
Lines: 24
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail