[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Off Topic: TCP/IP programming
On Thu, January 28 1999, guy keren <choo@actcom.co.il> 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 moment
|> 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 mome
|nt
|> the state of the socket buffer.
You better make that socket non-blocking and just be prepared that
some write's won't deliver all your data (user-level buffering). You
may find some version-specific ioctl's and such to check for these
numbers, but if you want a robust code (which you should) then you
should take into account the possibility that things may change
between the check for sufficient buffers and the attempt to write your
own buffer (either because someone else wrote to that socket or some
system-wide changes).
--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