Article View: borland.public.cppbuilder.internet.socket
Article #1270Re: WSAGetLastError return always 6
From: Remy Lebeau (TeamB)
Date: Mon, 26 Feb 2007 17:53
Date: Mon, 26 Feb 2007 17:53
34 lines
2237 bytes
2237 bytes
"Eduardo Jauch" <eduardo.jauch@gmail.com> wrote in message news:45e24baa@newsgroups.borland.com... > one of the recv return 0 bytes That means that the other party has closed the connection gracefully. > i'm not setting the socket to nonbloking and the connection does > not time out by server not responding nor something like that. recv does not return 0 in non-blocking mode when a timeout occurs. It returns SOCKET_ERROR (-1) and then WSAGetLastError() returns WSAETIMEOUT. > I'm using the recv to return only the HEAD (not using GET). You are probably not taking into account that the server will likely close the connection after sending its reply to any command. That is the default behavior for HTTP 1.0 requests. The connection is only left open when a keep-alive is negotiated between the client and the server as part of the command/response exchange. I'm guessing that you are not reading the HTTP protocol documentation carefully enough, as this is covered. > When i use WSAGetLastError, always return code 6 > I search on help but not find any error code 6 returned by > WSAGetLastError... WSAGetLastError() is only meaningful when a real error occurs. recv() returning 0 is not an error condition. Gambit
Technical Details
Message-ID:
<45e31e54$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!nx02.iad01.newshosting.com!newshosting.com!newsfeed.news2me.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<45e24baa@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,ead06e5a7c488245 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: <45e24baa@newsgroups.borland.com> Subject: Re: WSAGetLastError return always 6 Date: Mon, 26 Feb 2007 09:53:01 -0800 Lines: 36 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: 75.83.34.171 Message-ID: <45e31e54$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1172512340 75.83.34.171 (26 Feb 2007 09:52:20 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!newsfeed.news2me.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail