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

    send() 10055 socket error

    I had been looking in the forums for above similar problems but nothing matches the one Iam facing. So new thread is started, Please respond

    I have a VC++ application which uses TCP sockets. For some time the program is working good receiving and sending. When suddenly traffic boosts in the network with some other data packets, my send() is failing with error 10055 indicating insufficient buffer left.

    Whatz the work around to eliminate the error?
    (In quiet other few forums, suggestion for implementation of Non-Blocking I/0 was made. I used select, the select also fails with same error)

    Please suggest what could be done for this error.

  2. #2
    Join Date
    Jun 2005
    Location
    Buenos Aires, Argentina
    Posts
    66

    Re: send() 10055 socket error

    Quote Originally Posted by prakash_bv
    I have a VC++ application which uses TCP sockets. For some time the program is working good receiving and sending. When suddenly traffic boosts in the network with some other data packets, my send() is failing with error 10055 indicating insufficient buffer left.

    Please suggest what could be done for this error.
    You can use setsockopt() to increase the buffer size for the receive buffer.

    Code:
    int setsockopt (
      SOCKET s,                 
      int level,                
      int optname,              
      const char FAR * optval,  
      int optlen                
    );
    
    With:
    int buffer_size = <your buffer size>
    
    s = <the socket>
    level = SOL_SOCKET
    optname = SO_RCVBUF
    optval = &buffer_size
    optlen = sizeof(int)

  3. #3
    Join Date
    Feb 2003
    Location
    Bangalore, India
    Posts
    1,354

    Re: send() 10055 socket error

    I thought I replied to this thread. Might not have clicked the reply button.

    The error WSAENOBUFS basically means, the system lacks resource to perform the operation. The resource mostly means the Non-paged memory. This has a fixed upper limit and is tied with your total physical memory. Why your application get this type of error cannot be specifically answered without an investigation. However the possible caused can be
    • Not handling graceful closure
    • too many open sockets
    • some app or driver taking too many NP memory
    • Faulty driver not releasing NP memory etc

    What you can do is
    • send data in smaller packet ( less than 4K IMHO but the docs say less than 64K )
    • Set the send buffer to 0 ( SO_SNDBUF ), so the stack will take directly from the application buffer.
    • Ensure that the you are handling gracefull socket closure


    Changing the value of SO_SNDBUF won't have an effect in your case. See if this happens in other system with the same configuration.
    Even if our suggestions didn't help, please post the answer once you find it. We took the effort to help you, please return it to others.

    * While posting code sections please use CODE tags
    * Please check the codeguru FAQ and do a little search to see if your question have been answered before.
    * Like a post, Rate The Post
    * I blog: Network programming, Bible

    I do all things thru CHRIST who strengthens me

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