Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
12 years, 5 months ago.
how do I detect a disconnect?
I created a websocket server using node-webkit. The wifly connects to my network and websocket server without issues. The wifly stays connected for about a day then the wifly disconnects unexpectedly. How do I get the wifly to auto connect on a disconnect? My code consists of:
code:
int main()
{
wifly.init(); //Use DHCP
while (!wifly.connect());
printf("IP Address is %s\n\r", wifly.getIPAddress());
Websocket ws("ws://192.168.0.5:8080/");
while (!ws.connect());
while (1) {
ws.send("WebSocket Hello World over Wifly");
wait(0.5);
}
}
Question relating to:
1 Answer
12 years, 5 months ago.
bool Wifly::is_connected()
{
return (tcp_status.read() == 1) ? true : false;
}
This member function may solve your problem. Hope this helps, Guenter.