🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Hangs on socket read, despite timeout & antifreeze

#2655
From: DWilkinson
Date: Mon, 06 Mar 2006 19:39
36 lines
2329 bytes
"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!
Technical Details
Message-ID: <440c9e1f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.google.com!news.glorb.com!newsgate.cistron.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder1.cambrium.nl!feed.tweaknews.nl!news.netcologne.de!nhp.netcologne.de!news.schnuerpel.net!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail
References: <4408c710$1@newsgroups.borland.com> <4408f04d$3@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>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <440c9e1f$1@newsgroups.borland.com>
Date: 6 Mar 2006 12:39:59 -0700
X-Trace: newsgroups.borland.com 1141677599 207.105.83.66 (6 Mar 2006 12:39:59 -0700)
Lines: 39
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.google.com!news.glorb.com!newsgate.cistron.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder1.cambrium.nl!feed.tweaknews.nl!news.netcologne.de!nhp.netcologne.de!news.schnuerpel.net!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail