April 28th, 2011, 01:32 AM
question on send()
I can't set my socket to non-block and have set the buffer size to 32kbytes using SO_SNDBUF. When i send a message of size lower than 32kbytes then sometimes this call blocks.
what all could be the reason to block and is there a way to know prior sending message if buffer of that size is available or not.
Thanks in advance...
April 28th, 2011, 02:06 PM
Re: question on send()
Why can't you? Please explain the background of the problem a bit more.
Originally Posted by jazz123
Not in advance, but the value returned by the call to send() will tell you if all requested btyes were in fact sent.
...is there a way to know prior sending message if buffer of that size is available or not.
For the recv() function, there's the MSG_PEEK flag (whose use is subject to much criticism) which allows you to see in advance how many bytes are in the receive buffer, but AFAIK, there's no similar flag for the send function.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.