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.
I can't set my socket to non-block and have set the buffer size to 32kbytes using SO_SNDBUF.
Why can't you? Please explain the background of the problem a bit more.
...is there a way to know prior sending message if buffer of that size is available or not.
Not in advance, but the value returned by the call to send() will tell you if all requested btyes were in fact sent.
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.
Bookmarks