🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #942

Re: timeout of recv

#942
From: Eduardo Jauch
Date: Sun, 01 Jul 2007 16:48
48 lines
2477 bytes
Colin B Maharaj escreveu:
> 
> Yes it should, however I do things differently now.
> 
> Firstly I do not use thus timeout anymore.
> 
> I wrote some code where recv waits forever,
> then populates a string when data comes in
> and if one of the chars is a linefeed
> I trigger an event like this......
> 
> SetEvent(GotData);
> 
> where
> 
> HANDLE GotData = CreateEvent(NULL, false, false, NULL);
> 
> Then when I read a string, I do like this....
> 
> bool Timeout=false;
> AnsiString  __fastcall MySockets::ReadLn(int timeoutms)
> {
>   AnsiString A = "";
>   DWORD ret=WaitForSingleObject(GotData, timeoutms);
>   if (ret==WAIT_TIMEOUT) { Timeout=true; return A; }
>   if (ret==WAIT_OBJECT_0)
>   {
>     <PSEUDOCODE> A = ExtractData() </PSEUDOCODE>
>     return A;
>   }
>   return A; // maybe some other error....
> }
> 

hum...
I don't now if this aproach work on my application...

I download many html pages in a specific order, one after one...
They are different html, that depends on the results of the last.

Of course that will work... But I think that use timeout to determine if 
I need to restart is more simple... I'll try the firs option...

But I'll think in a way to use this... The problem is that I need 
"extreme" velocity, and I don't know if work with events is a good idea 
in this case...

Anyway, much thanks! =D
Technical Details
Message-ID: <4687dae7$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <46869b18$1@newsgroups.borland.com> <468715f2@newsgroups.borland.com> <46877297@newsgroups.borland.com> <4687acb2$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,76bc0c5b0ec153e0
X-Google-Attributes: gid11508e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Sun, 01 Jul 2007 13:48:43 -0300
From: Eduardo Jauch <eduardo.jauch@gmail.com>
User-Agent: Thunderbird 1.5.0.12 (Windows/20070509)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Re: timeout of recv
References: <46869b18$1@newsgroups.borland.com> <468715f2@newsgroups.borland.com> <46877297@newsgroups.borland.com> <4687acb2$1@newsgroups.borland.com>
In-Reply-To: <4687acb2$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 201.25.165.121
Message-ID: <4687dae7$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1183308519 201.25.165.121 (1 Jul 2007 09:48:39 -0700)
Lines: 48
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
X-Original-Bytes: 2332