I got a exception when I run that code on my android server device but I don't understand why, can you please help me.
WifiP2pDevice peer = wifiP2pDeviceList.getDeviceList().iterator().next();
String host = peer.deviceAddress;
ServerSocket serverSocket = new ServerSocket(2009);
Socket client = serverSocket.accept(); // I got the exception here
Exception : FATAL EXCEPTION: main android.os.NetworkOnMainThreadException