Help , a problem about the tcp client under dynamic DNS


#1

I use the wip tcp client function , connect to remote PC running a TCP server program. The remote PC have public dynamic IP address. So I use a Dynamic DNS for it.

wip_TCPClientCreateOpts( myDynaDomain.com, 1024, myTcpHandler, NULL, WIP_COPT_KEEPALIVE, 10, WIP_COPT_END);

the module work fine, but have some problem in below even:

1 When the network drop ( for example , the remote PC network cable been pull ) , no any error showed by the module.

2 When the remote PC IP address is changed, the module can’t reconnect to the new IP by the dynamic domain. until reboot the module.

Maybe I use the function in wrong way, please give me some advice. thanks.


#2

Your myTcpHandler should raise event WIP_CEV_PEER_CLOSE, if not you must check return value from your function.

wip_TCPClientCreateOpts( myDynaDomain.com, 1024, myTcpHandler, NULL, WIP_COPT_KEEPALIVE, 10, WIP_COPT_END);

I’m not sure with this case, MAYBE it caching DNS answer before, I don’t know :question: :question: :question:


#3

That seems highly probable…


#4
  1. The WIP_CEV_PEER_CLOSE will catch by myTcpHandler only the remote PC TCP server program regular close the connection. But when the network drop, nothing event will be catched. I think the WIP_COPT_KEEPALIVE should have some help for this case, but nothing change.

  2. I think so. The DNS result might be cached by the module. Does any method to clear the cache, or setting the wip_TCPClientCreateOpts auto update the DNS again in establish the new connection?