Home > Back-end >  ServerSocket. Accpet () the failure reason and solution
ServerSocket. Accpet () the failure reason and solution

Time:03-25

Create a serverSocket (9999), and continue to monitor
 ServerSocket ServerSocket=new ServerScoket (9999); 


int count=0;


While (true) {


//call the accept () method, to start listening, waiting for the client connection


The Socket Socket=serverSocket. The accept ();


count++;


If (count!=0) {


System. The out. Println (" the number of connection: "+ count);


}


}

Multiple clients simultaneous connections, part of the client display has connection socket, but accpect () did not listen to the connection of the client, the client sends the message, also did not receive part of the client is normal,
  • Related