Showing results for 
Search instead for 
Did you mean: 

Winsock send and recv problem

I have an application that sends and receives small packets of data on a tcp/ip socket.

My application sends the data and then waits for a response.


My applications works great in debug mode but when I try it in release mode I have problems.


I will be sending data packets using:

   sendStatus = send( cmdSock, (char *)msg, msgLen, 0 );

   if( sendStatus == SOCKET_ERROR )

     // Send error


And receiving:

   if( select( 0, &readfds, 0, 0, &timeout ) == 0 )
     // socket timed out


  status = recv( cmdSock, (char *)msg, msgLen, 0 );
   if( status == SOCKET_ERROR )
     // recv error



The application will be sending many packets about every 1 second. Then randomly, a packet will fail because of a socket timed out.

When the error occurs:

The send command sends the data, No SOCKET_ERROR comes back.

The recv command times out waiting for the response.


When the error occurs the application that is receiving the data packets never received the data packet, and thus does not respond.


Again this ONLY happens in Release configuration, it NEVER fails in Debug configuration.


Has anyone ever seen an issue like this?



John W.



0 Kudos
Message 1 of 2

Hey jwinterb,


Could you be a little more specific on what the error is you actually seeing? What is the error code you are seeing if any? Could you post your CVI project so others can look at the code? Are you able to run a CVI TCP/IP example with no issues? Help » Example Finder » TCP/IP 



Applications Engineer
National Instruments
0 Kudos
Message 2 of 2