hi i m a beginner in java i have a doubt:
in the case for example i write a game with a server and 3 clients and since i dont need threads because clients follow a decided order and only one of them can play in its turn,
can i put the server in listening and execute some code like this :
while((i++ < maxConnections) ){
Socket connection = listener.accept();
// code that saves the "connection" to a player Object
//not closing the connection
}
tell me if i am wrong (interested in the part after the accept):
if i dont close the connection each time a create it for each client, can i write and read form the stream every time i need it ?? ( using the connection variable saved in each player object ) i ll close the connection only when the client has finished all the communication with the server
if i dont close it, the second client cannot connect? is it only possible with threads ?
sorry but i am really confused on netprogramming