There are 1 code examples for java.io.InterruptedIOException.
The API names are highlighted below.
You can use
button
to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.
Project Name: megamek Package: megamek.server
Source Code: Server.java (Click to view .java file)
Method Code:
/**
* Listen for incoming clients.
*/
public void run(){
Thread currentThread=Thread.currentThread();
System.out.println("s: listening for clients...");
HashSet<IConnection> toUpdate=new HashSet<IConnection>();
while (connector == currentThread) {
try {
Socket s=serverSocket.accept();
int id=getFreeConnectionId();
System.out.println("s: accepting player connection #" + id + " ...");
IConnection c=ConnectionFactory.getInstance().createServerConnection(s,id);
c.addConnectionListener(connectionListener);
c.open();
connectionsPending.addElement(c);
greeting(id);
ConnectionWatchdog w=new ConnectionWatchdog(this,id);
timer.schedule(w,1000,500);
}
catch ( InterruptedIOException iioe) {
}
catch ( IOException ex) {
}
toUpdate.clear();
toUpdate.addAll(connections);
toUpdate.addAll(connectionsPending);
Iterator<IConnection> it=toUpdate.iterator();
while (it.hasNext()) {
it.next().update();
}
it=toUpdate.iterator();
while (it.hasNext()) {
it.next().flush();
}
}
}