Home > Mobile >  Android studio socket error
Android studio socket error

Time:10-06

Try {

If (socket==null) {

//initialize the Scoket, connect to the server
The socket=new socket (ServerIP, ServerPort);
IsConnect=true;
//start receiving threads
IsReceive=true;
ReceiveThread=new receiveThread (socket);
ReceiveThread. Start ();
System. The out. Println (" -- -- connected success -- ");

}
} the catch (UnknownHostException e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
System. Out.println (" UnknownHostException - & gt;" + e. oString ());
} the catch (IOException e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
System. The out. Println (" IOException "+ e. oString ());
//throw exceptions don't know the reason why
////java.net.SocketException:Network is unreachable
}

CodePudding user response:

Code is no problem, I don't have the phone WLEN set it to a network segment,

CodePudding user response:

I come to meet

CodePudding user response:

  • Related