Will customers need to connect multiple servers to create multiple accept () do

Category: Java SE
 
dearkp
2011-04-03 07:25:09

Sponsored Links
Will customers need to connect multiple servers to create multiple accept () do?
if the procedure is the following
socketserver player1, player2;
player1.accept ();
player1.accept ();
Thread.start ();

is not waiting two connections to perform the fourth step in the process procedure, I saw some books, the server simply create an accept () receives client connection on the line, did not want to create two accept the above (), can you?

Sponsored Links

a85401234
2011-04-03 07:40:16
which was released in the server segment of the program is an infinite loop, player1.accept (); / / is the client visit when creating a socket, is assigned to the client, to communicate!
hohopro
2011-04-03 07:45:55
In fact it works is like this, for example:
while (true) {
player1.accept () ;/ / keep listening!
}
zhoubin_689
2011-04-03 08:00:28
Why
while (true) {
player1.accept ();
}
is to constantly monitor
guangxu888
2011-04-03 08:10:03
Thank you, to the sub-Oh, the future continues to help
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.