AnsweredAssumed Answered

TCP socket connection fail when webserver is active

Question asked by Michele Korell on Nov 5, 2013
Latest reply on Dec 12, 2013 by Michele Korell

Hello

 

Now i'm using mqx 4_0_2, with cw10.4. When i try to connect with a PC to the tcp socket on a twr-k60f120m with a webserver active the connection works only the half of the time. When i deactivate the embedded webserver it's work great.

I have searched on differents discussion on this forum and after trying to augment the tcp socket connection limits the problem doesn't disappear.

Here is the code that get the incoming socket connection:

 

//Block here until they are socket activity
sockSet[0] = mySocket->listenSock;
sockSet[1] = mySocket->sock;
sock = RTCS_selectset(sockSet, 2, 0);

if(sock ==mySocket->listenSock)
{
 ...
 //Test incoming connection
 if(mySocket->sock == 0)
 {
  mySocket->sock = accept(mySocket->listenSock, &mySocket->remoteAddr, &mySocket->remoteAddrLen);
  ...
}
...
}




I don't know if they are any error in these connection logic or if are something to activate in the user_config to run the webserver and a socket connection together.

 

UPDATE:

When the connection doesn't work, in the RTCS socket summary i see that my socket is connected and it appear a socket with ground state. When the task work well, the socket in ground state doesn't appear.

RTCS_SockProblem.PNG.png

Any one can help me?

Thanks

Outcomes