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.

RTOS/TM4C1294NCPDT: Detection of socket disconnection in network communication

Part Number: TM4C1294NCPDT

Tool/software: TI-RTOS

Hi, 

I am using a custom board with TM4C1294NCPDT micro controller as a client and a separate server is running on a computer.  

I have created a TCP/IP socket as follows: sock  = socket(AF_INET, SOCK_STREAM, 0); on which i listen to the server.

I use the following API to receive data from the server recv(sock , recv_buf, MES_MAX_READ_BUFF, MSG_DONTWAIT);. i'm using MSG_DONTWAIT flag to make the function non blocking. Is this the right flag to make the recv function non-blocking?

Also, if the socket connection is broken, how do i detect it?