MC60 Problem with receiving socket data

Hello Quectel Support,

I am using a new GSM EVB Kit (OpenCPU SDK1.6 and base firmware MC60CAR01A15) with MC60-TE-A Kit to create a simple chat client.
I am trying example_tcp_demo to send and receive data from server, the client keep listening data on socket and should print as soon as any data arrives. This program is able to send the data, and receive the response in Callback_Socket_Read, but the problem is the code stucks in receive while loop forever.

The Callback_Socket_Read never return even if there is no data on socket, and if we break from this loop when len read is 0, the socket connection is automatically closed. Whereas, I expect this Callback_Socket_Read to get called whenever there is data to from from the socket.

image image

Dear Trakbond
I’ve seen a “do while” statement in my program, that’s going to keep my program looping around, so if you want to keep your program looping around, you shouldn’t put a “True” in your “while” argument, so you can only put an argument that’s going to change in the loop.And since “Callback_Socket_Read” is already a callback function, you can simply read or print data directly from the callback function instead of looping through it.