-
April 28th, 2011, 01:32 AM
#1
question on send()
Hi,
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
#2
Re: question on send()
Originally Posted by jazz123
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.
Mike
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|