Article View: borland.public.cppbuilder.internet.socket
Article #5041Re: select() & ioctlsocket() problem
From: Remy Lebeau (TeamB)
Date: Mon, 25 Oct 2004 16:10
Date: Mon, 25 Oct 2004 16:10
24 lines
1735 bytes
1735 bytes
"PaoloItaly" <paolot@FAKETHESPAMMERsirius-es.it> wrote in message
news:417ca194$1@newsgroups.borland.com...
> fd_set read_fd;
> FD_ZERO(&read_fd);
> FD_SET(sock, &read_fd);
> ret = ::select(sock+1, &read_fd, NULL, NULL, NULL);
First off, why are you using "sock+1" when calling select()? You should not
be doing that. Fortunately for you, the first parameter of select() is
completely ignored in modern implementations now, so it doesn't effect
anything. But why were you doing it in the first place? Just pass 0
instead:
ret = ::select(0, &read_fd, NULL, NULL, NULL);
> ::WSAEventSelect(s->socket, s->event, FD_CLOSE);
> ::WSAWaitForMultipleEvents(1, event, FALSE, 0, FALSE);
Did you call recv() first to make sure that it is returning 0 bytes?
Gambit
Technical Details
Message-ID:
<417d2558$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4178ed30@newsgroups.borland.com> <417aad3c$1@newsgroups.borland.com> <417ca194$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,594e3ed9f24a168f 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: <4178ed30@newsgroups.borland.com> <417aad3c$1@newsgroups.borland.com> <417ca194$1@newsgroups.borland.com> Subject: Re: select() & ioctlsocket() problem Date: Mon, 25 Oct 2004 09:10:48 -0700 Lines: 26 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: <417d2558$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1098720600 68.69.17.41 (25 Oct 2004 09:10:00 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail