[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Off Topic: TCP/IP programming




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 moment
> the state of the socket buffer.

i didn't check, but i guess you could check out the sockets programming
FAQ (someone sent this URL on this list a month or 2 month ago):

http://kipper.york.ac.uk/~vic/sock-faq/

and if that has no answer, try checking W. richard stevens' "unix network
programming" book(s).

guy

p.s. it might be that this info is OS-specific, and then perhaps scanning
the manual pages on your system will reveal this information.

however, as far as i know, you can simply perform a write() on the socket,
and it will return after writing only part of the data. if there is a
probelm, you can temporarily set the socket to non-blocking, then perform
the write operation, and then restore the blocking mode of the socket.