Tool/software: TI-RTOS
XDCtools 3.32, SYS/BIOS 6.46, CCS 7.4, PDK 4.0.7, NDK 2.25
I have a pair of applications, both running on EVMK2HX that need to communicate over TCP/IP.
I have one configured as a server using the network stack very similar to the NIMU_emacExample except setup for TCP. I have dameons set up as listeners:
DaemonNew( SOCK_STREAMNC, 0, DATA_PORT, data_connection_established, TCP_LISTENER_TASKPRI, OS_TASKSTKNORM, DATA_PORT, 2 );
On the other EVM I create a socket and connect it to the server. I then have one task call recv() and another task used to occasional send(). I am using the Legacy Non-BSD Sockets Interface. No socket options are set. (no socksetopt calls).
The above is working fine. I can connect and exchange data. My problem is detecting a network disconnect. If I physically remove the Ethernet cable, I get no indication that there is a problem in the client application. I would have expected that the recv() would have returned a -1.
I am not sure what happens on the server application at this point – I only have CCS connected to the client EVM at the moment. The server should be continuing trying to send data.
After some long period of time (5 minutes?) the client recv() call finally returns -1 and the connection is recognized as down.
My question is; how can I configure the sockets so that if the cable is removed it is detected? I can set options on both the client and the server side. Keep Alive? Socket TO? Any suggestion would be very welcome.
Mike