CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2010
    Posts
    6

    sendto() returns error 10035

    Hi,

    I've a multi-treaded Windows 2003 Server application that sends and receives UDP packets at a high rate and over a single socket. The socket is configured to work in non-blocking mode and several threads may call the sendto() function over this socket, though there is only thread that reads from the socket. When the application calls sendto() at a very high rate that exceeds a certain threshold, we see that calls to sendto() start failing with the error code 10035 (function would block). The threshold seems to be the point where the sendto() gets called at around 7500 times per second. At this time, the application is receiving data at around the same rate, however, the recv() function works fine. Windows reported network usage at this point is around 30 mbps, or 30% on our 100 mbps fast ethernet. CPU usage on our quad-code box is around 70% at this point. Suspecting a LAN or NIC problem, I tried to run this application along with its client on the same box so that we have no actual traffic going through the NIC to the LAN. I got the same result in this test and sendto() started failing at around the same point. I'll appreciate if anyone can help me with this issue.

  2. #2
    Join Date
    Feb 2005
    Posts
    2,160

    Re: sendto() returns error 10035

    You're going to have to wrap your sendto() calls with a mutex or a critical section. It is not possible for more than one thread to call sendto() at the same time on the same socket. They are colliding at the rate you're sending data over the socket.

  3. #3
    Join Date
    Mar 2010
    Posts
    6

    Unhappy Re: sendto() returns error 10035

    Thanks. I used to think that socket function calls are thread-safe. Anyway, I followed your advice, and had the sendto() function calls enclosed in critical_section. However, I'm still experiencing this issue.

  4. #4
    Join Date
    Feb 2005
    Posts
    2,160

    Re: sendto() returns error 10035

    "Thread Safe" just means that the call is reentrant. There is no global or static data modified by the call. In your case, it is the socket itself that is not thread safe.

  5. #5
    Join Date
    Mar 2010
    Posts
    6

    Re: sendto() returns error 10035

    But what about it still failing after putting the critical section in place. Thanks.

  6. #6
    Join Date
    Feb 2005
    Posts
    2,160

    Re: sendto() returns error 10035

    How are you implementing the CS?

  7. #7
    Join Date
    Mar 2010
    Posts
    6

    Re: sendto() returns error 10035

    I'm using Win32 CriticalSection. Calls to sendto() are sandwiched between EnterCriticalSection() and LeaveCriticalSection() calls.

  8. #8
    Join Date
    Feb 2005
    Posts
    2,160

    Re: sendto() returns error 10035

    And your still getting the error 10035? I'm not sure, but then again, I've never tried to pump that many data through a UDP socket before. Perhaps it is a limitation of the TCP/IP stack or the network itself.

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