void Set_NetApp_Timeout(void) { unsigned long aucDHCP = 14400; unsigned long aucARP = 3600; unsigned long aucKeepalive = 10; unsigned long aucInactivity = DEFAULT_SEC_INACTIVITY; SPARK_WLAN_SetNetWatchDog(S2M(DEFAULT_SEC_NETOPS)+ (DEFAULT_SEC_INACTIVITY ? 250 : 0) ); netapp_timeout_values(&aucDHCP, &aucARP, &aucKeepalive, &aucInactivity); }
int TCPClient::connect(IPAddress ip, uint16_t port) { int connected = 0; if(isWanReady()) { sockaddr tSocketAddr; _sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); DEBUG("socket=%d",_sock); if (_sock >= 0) { flush(); tSocketAddr.sa_family = AF_INET; tSocketAddr.sa_data[0] = (port & 0xFF00) >> 8; tSocketAddr.sa_data[1] = (port & 0x00FF); tSocketAddr.sa_data[2] = ip._address[0]; tSocketAddr.sa_data[3] = ip._address[1]; tSocketAddr.sa_data[4] = ip._address[2]; tSocketAddr.sa_data[5] = ip._address[3]; uint32_t ot = SPARK_WLAN_SetNetWatchDog(S2M(MAX_SEC_WAIT_CONNECT)); DEBUG("_sock %d connect",_sock); connected = (socket_connect(_sock, &tSocketAddr, sizeof(tSocketAddr)) >= 0 ? 1 : 0); DEBUG("_sock %d connected=%d",_sock, connected); SPARK_WLAN_SetNetWatchDog(ot); if(!connected) { stop(); } } }