🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Hangs on socket read, despite timeout & antifreeze

#2656
From: DWilkinson
Date: Mon, 06 Mar 2006 20:18
43 lines
2491 bytes
"DWilkinson" <dennis.c.wilkinson@boeing.com> wrote:
>
>"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>>
>>"DWilkinson" <dennis.c.wilkinson@boeing.com> wrote in message
>>news:4408c710$1@newsgroups.borland.com...
>>
>>> My program is hanging on a socket read (
>>...IdTCPClient1->Socket->Recv(msg, 600); )
>>
>>You should not be calling Recv() directly.  Use the TIdTCPClient's own
>>ReadBuffer() method instead:
>>
>>    IdTCPClient1->ReadBuffer(msg, 600);
>>
>>Timeouts are handled at a higher level, but you are trying to access a
>>lower-level method.
>>
>>> despite having set the Readtimeout
>>
>>Recv() is not subject to the ReadTimeout.  That is why you should not be
>>calling the IOHandler's reading methods directly.
>>
>>
>>Gambit
>>
>>
>
>The reason I was using Recv() rather than ReadBuffer() is that I get no response other than a time-out when I do. 
>
>I assume the reason for this is that ReadBuffer() does not return until the read buffer has been filled. 
>
>However, in my application, I don't know size of the incoming message beforehand, other than the maximums.
>
>So how do I read variable length messages?
>
>Your assistance is greatly appreciated!
>

Also, incoming data has no terminator character, so I don't think I can use ReadLn() either. And IdAntiFreeze doesn't seem to do anything, as the application is hung until the timeout occurs when using ReadBuffer().

Again, thank you for your help.
Technical Details
Message-ID: <440ca73f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4408c710$1@newsgroups.borland.com> <4408f04d$3@newsgroups.borland.com> <440c9e1f$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,78f66e549d65ce51
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "DWilkinson" <dennis.c.wilkinson@boeing.com>
Sender: "DWilkinson" <dennis.c.wilkinson@boeing.com>
Reply-To: "DWilkinson" <dennis.c.wilkinson@boeing.com>
Subject: Re: Hangs on socket read, despite timeout & antifreeze
Newsgroups: borland.public.cppbuilder.internet.socket
X-User-Info: 128.152.20.33     
X-Forwarded-For: 147.20.65.138
References: <4408c710$1@newsgroups.borland.com> <4408f04d$3@newsgroups.borland.com> <440c9e1f$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <440ca73f$1@newsgroups.borland.com>
Date: 6 Mar 2006 13:18:55 -0700
X-Trace: newsgroups.borland.com 1141679935 207.105.83.66 (6 Mar 2006 13:18:55 -0700)
Lines: 43
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail