When Wifi disconnect, how does Socket on Android server side know that? -


i developed android app, works in wifi ap mode socket server. clients setup wifi connection , socket connection app. when socket connected, disconnect wifi connection client, there no exception nor read method of socket return -1 in server app. questions are:

  1. how detect broken wifi connection
  2. how detect client's wifi connection broken

thanks.

use in thread

public static boolean checknetworkconnection(context context)    {        final connectivitymanager connmgr = (connectivitymanager)context.getsystemservice(context.connectivity_service);        final android.net.networkinfo wifi =connmgr.getnetworkinfo(connectivitymanager.type_wifi);       final android.net.networkinfo mobile =connmgr.getnetworkinfo(connectivitymanager.type_mobile);        if(wifi.isavailable()||mobile.isavailable())           return true;       else          return false;    }   

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -