🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: WSA????

#15957
From: Tharun Pillay
Date: Thu, 05 Jun 2003 08:56
49 lines
2866 bytes
Hey Bob. Thats pretty helpful.

I've tried the following code in the OnConnect event of the TClientSocket
though it returns 10038:

WSAAsyncSelect ((SOCKET)Socket->Handle, Handle, WM_FD_CLOSE, FD_CLOSE)


What am I doing wrong here?


--------------------------------------------------------------------------

WSAENOTSOCK
(10038)
  Socket operation on nonsocket.
  An operation was attempted on something that is not a socket. Either the
socket handle parameter did not reference a valid socket, or for select, a
member of an fd_set was not valid.


"Bob Gonder" <notbg@notmindspring.invalid> wrote in message
news:obssdvopq540mjv03irip73n9rmd9aes4k@4ax.com...
> >"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/win
sock/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: <3edf04e1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!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> <obssdvopq540mjv03irip73n9rmd9aes4k@4ax.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-05 01:59:28 PST
From: "Tharun Pillay" <tharun@webmail.co.za>
Newsgroups: borland.public.cppbuilder.nativeapi
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> <obssdvopq540mjv03irip73n9rmd9aes4k@4ax.com>
Subject: Re: WSA????
Date: Thu, 5 Jun 2003 10:56:13 +0200
Lines: 51
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 196.15.202.200
Message-ID: <3edf04e1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1054803169 196.15.202.200 (5 Jun 2003 01:52:49 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail