🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TServerSocket/TClientSocket send buffer error 10053 and 10057

#773
From: Remy Lebeau (TeamB)
Date: Mon, 29 Oct 2007 16:55
41 lines
2888 bytes
"newsgroups.borland.com" <lapoguidi@alice.it> wrote in message 
news:4724bebc@newsgroups.borland.com...

> I have a TServerSocket in non-blocking listening on port 5678.

Is the client running in blocking or non-blocking mode?

> It seems to work fine for some time, then the error 10053 appears.

On which side?  The client or the server?

> What I'm doing wrong?

You are not using the return value of SendBuf() on the server side, or the 
return value of ReceiveBuf() on the client side.

The server is non-blocking, so you need to use its OnWrite event when 
blocking transmissions occur.  When SendBuf() returns -1 without raising an 
exception or generating an OnError event, you have to buffer the data you 
were trying to send at the time and then re-send it when the OnWrite event 
is triggered at a later time.  You have to do that on a per-connection 
basic, so I suggest you make use of TCustomWinSocket's Data property for 
that.  One thing you could do is store a TMemoryStream object in that 
property, and then cache the data when needed.  Please go to 
http://www.deja.com and search through the newsgroup archives.  I've posted 
examples of this several times before.

You are also not checking the return value of ReceiveLength() on the client 
side for values less than 1.  If your client is running in non-blocking 
mode, then multiple packets can trigger multiple OnRead events.  However, 
your reading in the first event may receive all of the available data from 
both events, leaving nothing for the second event to read.  So you need to 
account for that possibility.

Alternatively, you might consider switching to a UDP-based protocol, such as 
MultiCasting or RTP, instead of trying to use TCP for real-time 
broadcasting.  TCP is not really designed for that.


Gambit 
Technical Details
Message-ID: <472610c1$3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4724bebc@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,f596705b7af33f46
X-Google-Attributes: gid11508e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <4724bebc@newsgroups.borland.com>
Subject: Re: TServerSocket/TClientSocket send buffer error 10053 and 10057
Date: Mon, 29 Oct 2007 09:55:38 -0700
Lines: 43
Organization: Lebeau Software
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 207.178.157.90
Message-ID: <472610c1$3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1193676993 207.178.157.90 (29 Oct 2007 09:56:33 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail