🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TWinSocketStream::Read

#2143
From: Remy Lebeau (TeamB)
Date: Mon, 31 Jul 2006 17:08
31 lines
2309 bytes
"SF" <invalid@NOSPAMinvalid.com> wrote in message
news:44ce1ea3@newsgroups.borland.com...

> what happens if a connected socket (client or server, blocking or
> non-blocking doesn't matter) receives a lot of data, but the
> application doesn't read it (or it's not fast enough)?

The unread data remains in the receiving socket's internal buffer.
Eventually, the buffer will fill up.  Once the buffer cannot accept any
further data, the sending side will do one of the following:

1) if the sending socket is non-blocking, then any writing will fail with an
WSAEWOULDBLOCK error until the receiving buffer has been cleared.  At which
time the sender will receive a FD_WRITE notification indicating that the
socket can be written to again.  In the meantime, any outbound data that
returned a WSAEWOULDBLOCK error would have to be cached so that it can be
sent at a later time so that it is not lost.

2) if the sending socket is blocking, then any writing will simply block
until the receiving buffer is cleared.  Unless there is a writing timeout
applied to the socket, in which case the writing will fail if the timeout
elapses.

> Is it like a serial port that after a while there's a buffer
> overflow (with loss of data)?

No.


Gambit
Technical Details
Message-ID: <44ce3984$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.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: <44c866d6@newsgroups.borland.com> <44c8ece1$1@newsgroups.borland.com> <44c9b42a@newsgroups.borland.com> <44ca40fd$1@newsgroups.borland.com> <44ce1ea3@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,178c2a5464235f3f
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: <44c866d6@newsgroups.borland.com> <44c8ece1$1@newsgroups.borland.com> <44c9b42a@newsgroups.borland.com> <44ca40fd$1@newsgroups.borland.com> <44ce1ea3@newsgroups.borland.com>
Subject: Re: TWinSocketStream::Read
Date: Mon, 31 Jul 2006 10:08:56 -0700
Lines: 33
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: <44ce3984$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1154365828 68.69.17.41 (31 Jul 2006 10:10:28 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.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