CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2011
    Posts
    3

    Post 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...

  2. #2
    Join Date
    Nov 2002
    Location
    California
    Posts
    4,556

    Re: question on send()

    Quote Originally Posted by jazz123 View Post
    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
  •  





Click Here to Expand Forum to Full Width

Featured