This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

sending data using client-example, without receiving

Hello

i am using  the NDK 2.0 and CCS3.3 to program the DSP side  of the OMAP L137 and have reduced the client.pjt from the NDK  to only run the echo-server.

Sending data, if i receive a message works fine, but now i would like to send data frequently, after i have received a certain message, that the client-application is ready to receive the data. My code within the idle loop of the echosrv() (not the deamon-version, if this is a matter)  looks like followed:

 

 

(...)

 if( stcpactive != INVALID_SOCKET && FD_ISSET(stcpactive, &ibits) )
 {
            // There is data available on the active connection
            cnt = (int)recvnc( stcpactive, (void **)&pBuf, 0, &hBuffer );
            if( cnt > 0 )
            {
                 while(stcpactive != INVALID_SOCKET)
                 {
                       if(my_turn==1)
                       {
  
                             for (i = 0; i < 4096; i++)
                             {
                                  *((buffer)+i)= sendData[i];
                             } 

                            if( send( stcpactive, buffer, 4096, 0 ) < 0 )
                           {
                             fdClose( stcpactive );
                              stcpactive = INVALID_SOCKET;
                           }
                            my_turn=0;
                      }  
                 }

                recvncfree( hBuffer );
         }
          
             // If the connection got an error or disconnect, close
         else
         {
                 fdClose( stcpactive );
                 stcpactive = INVALID_SOCKET;
          }

}

Without the bold underlined lines  the task works fine, but needs to receive a package before it sends the calculated data.

 (my_turn is used in this testing-version to determine if Data has been sent (and new data can be calculated) or not)

(I would like to continously send data until the client is unavailable)

with these lines, both of my tasks stop working..

 

am i overlooking some issue to perform send and receive without the other?

 

best regards Rico.