Article View: borland.public.cppbuilder.internet.socket
Article #1278Re: WSAGetLastError return always 6
From: Eduardo Jauch
Date: Mon, 26 Feb 2007 20:40
Date: Mon, 26 Feb 2007 20:40
60 lines
3152 bytes
3152 bytes
Remy Lebeau (TeamB) escreveu: > "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. > Yes. I find it. :) The HEAD returned too says "Connection: closed" > 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 a litle confused now... I must use non-bloking or bloking to make the recv WAIT for the response? > You are probably not taking into account that the server will likely > close the connection after sending its reply to any command. No. I'm not. But is because the server don't do this. Only after many iterations (requests) it do that. > 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. Oh, I'm reading carefully, yet I don't understand all of it of course but I'm only begining ;) It's exactly because this that I choose to use HTTP 1.1. On the documentation says that the connection will keep alive for default. But if i misunderstood, plese, tell me. > WSAGetLastError() is only meaningful when a real error occurs. recv() > returning 0 is not an error condition. Yes. Now that I put it after the line on the recv that return the 0 byte, it always return 0. Because i'm not using HTTP 1.0 and the request (HEAD and GET) don't change every looping, I'm guessing that or the server is programed to close connections that make too requests within a few time, or it is changing the session cookies at that time... I'm more inclinated to believe on the first. Anyway, it don answer why I need to kill the thread to make things working again, even if I try to reconnect and begin the whole proccess from begining. It's seens that my code have a problem that I not yet find... Still looking for it... Thanks :)
Technical Details
Message-ID:
<45e34585$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<45e24baa@newsgroups.borland.com> <45e31e54$1@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 Date: Mon, 26 Feb 2007 17:40:27 -0300 From: Eduardo Jauch <eduardo.jauch@gmail.com> User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: WSAGetLastError return always 6 References: <45e24baa@newsgroups.borland.com> <45e31e54$1@newsgroups.borland.com> In-Reply-To: <45e31e54$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 201.89.67.188 Message-ID: <45e34585$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1172522373 201.89.67.188 (26 Feb 2007 12:39:33 -0800) Lines: 60 Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail