M66 TCP/UDP Server not able to receive data

Hi,

I ran example_tcpserver.c and example_udpserver.c and sent data from Packet Sender desktop app to the module’s Local IP address. But not able to receive any data in the module. But I’m able to send data to cloud using example_http.c. So no issues with gprs connection. Following is the log from TCP server. Any help is appreciated.

<–OpenCPU: TCP Server.–>
<-- RIL is ready -->
<–SIM card status is normal!–>
<–Network State:creg=2,cgreg=2–>
<–Network State:creg=2,cgreg=2–>
<–Network State:creg=2,cgreg=2–>
<–Network State:creg=2,cgreg=2–>
<–Network State:creg=2,cgreg=2–>
<–Network State:creg=1,cgreg=2–>
<–Network State:creg=1,cgreg=2–>
<–Network State:creg=1,cgreg=2–>
<–Network State:creg=1,cgreg=2–>
<–Network State:creg=1,cgreg=1–>
<–Register GPRS callback function successfully.–>
<–Waiting for the result of GPRS activated.,ret=-2.–>
<–CallBack: active GPRS successfully.–>
<–Get DNS address successfully,primaryAddr=59.144.144.106,bkAddr=203.145.160.5–>
<–Get Local Ip successfully,Local Ip=100.120.237.166,port=22000–>
<–Register socket callback function successfully.–>
<–Create socket id successfully,socketid=0.–>
<–Bind local port successfully.–>
<–Set listen socket successfully.–>

Thanks

Hello, you don’t need OPEN to see if you can receive data.In other words, whether the sending AT command can be connected to the platform to receive the data.You can check if it’s the server or the open code.

Thanks for the response. As you said we can initiate connection from the module and then get data from server. For that we need to poll often. According to below link, it looks like devices in mobile networks may not be able to receive incoming connections as they are behind operator’s NAT.