Article View: borland.public.cppbuilder.internet.socket
Article #2571Re: Inactivity timeouts in sockets?
From: Remy Lebeau (TeamB)
Date: Mon, 27 Mar 2006 23:36
Date: Mon, 27 Mar 2006 23:36
53 lines
2605 bytes
2605 bytes
"Martin" <dev@no.comppromed.spam.com> wrote in message
news:44285053$1@newsgroups.borland.com...
> I don't think I'm leaving anything in the input
> buffer. Here's the OnRead event:
You should be calling ReceiveLength() before calling ReceiveBuf()
void __fastcall socketClass::onRead(TObject *Sender, TCustomWinSocket
*Socket)
{
char buf[ 4096];
int numBytes;
do
{
numBytes = Socket->ReceiveLength();
if( numBytes > 0 )
numBytes = Socket->ReceiveBuf(buf, min(sizeof(buf),
numBytes));
if( numBytes < 1 )
break;
if( cfg.comDiag > 1 )
audit( HERE, "%s %s:onRead - Recving %d bytes\n",
currentTime(), this->sktId, numBytes);
inBuf->writeData(buf, numBytes);
}
while( true );
}
> inBuf is a ring buffer class that we wrote years ago. It stores the
> data until the app has a chance to get around to it (within 0.5 sec.).
> It's possible that the ring buffer is messing with me but it's been in
> use longer than the underlying socket stuff.
Are you sure that you are not filling the buffer beyond its capacity,
overriding the surrounding memory?
Did you verify that the sending application is actually sending its data
without errors?
Also, non-blocking sockets rely on the message queue, so are you blocking
the queue at any time from processing new messages?
Are there are firewalls or routers in between your application and the
sending application, which might be blocking the data?
Gambit
Technical Details
Message-ID:
<44287752$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.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-mailReferences:
<44281b29$1@newsgroups.borland.com> <44282b0d$1@newsgroups.borland.com> <44285053$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,11a7fa37087eb9c 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: <44281b29$1@newsgroups.borland.com> <44282b0d$1@newsgroups.borland.com> <44285053$1@newsgroups.borland.com> Subject: Re: Inactivity timeouts in sockets? Date: Mon, 27 Mar 2006 15:36:00 -0800 Lines: 55 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: 68.69.17.41 Message-ID: <44287752$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1143502674 68.69.17.41 (27 Mar 2006 15:37:54 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.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