[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Off Topic: TCP/IP programming
On Thu, January 28 1999, abel@bfr.co.il (Alexander L. Belikoff) wrote:
|
|> On Sun, 24 Jan 1999, Eli Hadad wrote:
|>
|> > given TCP socket (or other socket),
|> > what is the best way to know how much buffer is available at a given momen
|t
|> > to write date into without blocking the process ( system call ???)
|> >
|> > We don't make the file-descriptor non-blocking, just to know in a
|> > given moment the state of the socket buffer.
|
|<to be checked in the Stevens book>
|
|I believe getsockopt(2) w/ SO_RCVBUF and SO_SNDBUF would do.
These will give you how much space is allocated for the send/recieve
buffers, but not how much of these is available right now. (e.g. it
can tell you that you have 64Kb allocated but still the next write(2)
of one byte will get blocked because all of this space is in use,
which is what the original poster wanted to avoid).
--Amos
--Amos Shapira | "Of course Australia was marked for
133 Shlomo Ben-Yosef st. | glory, for its people had been chosen
Jerusalem 93 805 | by the finest judges in England."
ISRAEL amos@gezernet.co.il | -- Anonymous