Article View: borland.public.cppbuilder.internet.socket
Article #1279Re: WSAGetLastError return always 6
From: Remy Lebeau (TeamB)
Date: Mon, 26 Feb 2007 21:35
Date: Mon, 26 Feb 2007 21:35
50 lines
2905 bytes
2905 bytes
"Eduardo Jauch" <eduardo.jauch@gmail.com> wrote in message news:45e3429c$1@newsgroups.borland.com... > No. My HTTP request is perfect. If it were, you would not be getting that error from the server in the first place. That error is almost always reported due to an incorrect request, usually becvause you left required fields out, or formatting them wrong. > Is after more than 15 iterations of the loop that I get the error. That does not mean that the requests were perfect every time to begin with. > char final[1024]; > > strcpy(final, "HTTP/1.1\r\nHost: www.visto-eua.com.br\r\nCookie: "); > strcat(final, cookies); > strcat(final, "\r\n\r\n"); I would STRONGLY advise you to re-think the approach you are taking with your socket programming. You are leaving your self open to all kinds of possible errors. The first, and most common, one being buffer overflows. You would be much better off if you wrap your socket code with more general operations (write a line, write a list of lines, read a line, etc). Your code would become a lot more solid, and a lot easier to work with. > You think that the server could change the coockies from time to time? Of course it can. You have to look at the cookies of EVERY reply and then update your cache accordingly. I seriously think you need to stop trying to implement HTTP from scratch and use a pre-made library. You would save yourself a LOT of hassle and problems. > Anyway, if I put a Sleep(5000) after test the return of recv to 0, > yet I continue getting the error. The server's error reply has NOTHING to do with HOW you are sending/receiving the data, and EVERYTHING to do with WHAT you are sending. Please show your complete request that is reporting the error. Gambit
Technical Details
Message-ID:
<45e352f6$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news1.google.com!newsfeed.gamma.ru!Gamma.RU!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<45e24baa@newsgroups.borland.com> <45e25047$1@newsgroups.borland.com> <45e25927$1@newsgroups.borland.com> <45e2b430$1@newsgroups.borland.com> <45e31ead$1@newsgroups.borland.com> <45e3429c$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 From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <45e24baa@newsgroups.borland.com> <45e25047$1@newsgroups.borland.com> <45e25927$1@newsgroups.borland.com> <45e2b430$1@newsgroups.borland.com> <45e31ead$1@newsgroups.borland.com> <45e3429c$1@newsgroups.borland.com> Subject: Re: WSAGetLastError return always 6 Date: Mon, 26 Feb 2007 13:35:22 -0800 Lines: 52 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: <45e352f6$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1172525814 75.83.34.171 (26 Feb 2007 13:36:54 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news1.google.com!newsfeed.gamma.ru!Gamma.RU!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail