On Thu, 2002-07-11 at 19:12, Alex Shnitman wrote:
> Hi,
>
> I'm using select() before write() to a TCP socket, in order to be sure
> that I won't block on the write() if the other end's network connection
> has broke. However, I found out that if I pass a buffer bigger than ~50k
> to write(), it will block anyway! Any idea what's up with that? write()s
> to a TCP socket are normally cut off at 102808 bytes, without blocking
> -- i.e. write() just returns this value if I pass a bigger size. I
> suspect that's the TCP window size so that's why the cut-off happens.
> But where is this 50k value coming from? Can I count on it being
> consistent, or can it happen with 20k or 2k one day? And why doesn't
> select() stand up to its promise, anyway?
because it doesn't promise ehat you think it promises.
>From the man page: "The functions select and pselect wait for a number
of file descriptors to change status."
That's it. The descriptor did change status but you gave write a bigger
byte then it can chew, so to speak. It promised you can write, but
didn't say how much.
If you don't want to block, request non blocking IO.
Gilad.
>
--
Gilad Ben-Yossef <[EMAIL PROTECTED]>
Code mangler, senior coffee drinker and VP SIGSEGV
Qlusters ltd.
"You got an EMP device in the server room? That is so cool."
-- from a hackers-il thread on paranoia
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]