Page MenuHomec4science

ServerWebService.java
No OneTemporary

File Metadata

Created
Mon, Jan 6, 23:35

ServerWebService.java

import java.io.IOException;
import java.net.ServerSocket;
import java.util.logging.Level;
import java.util.logging.Logger;
import utils.ServerProperties;
import framework.WorkerStandalone;
public class ServerWebService {
private static final Logger LOGGER = Logger.getLogger(ServerWebService.class.getName());
public static void main(String[] args) {
ServerProperties props = new ServerProperties("config/config_server.fry.properties");
ServerSocket ss = null;
int port = props.getPortServer();
try{
ss = new ServerSocket(port);
}catch(IOException e){
LOGGER.log(Level.SEVERE, "Cannot listen on port " + port, e);
try {
ss.close();
} catch (IOException e1) {
LOGGER.log(Level.SEVERE, null, e1);
}
System.exit(-1);
}
while(true){
WorkerStandalone w;
try{
w = new WorkerStandalone(props, ss.accept());
Thread t = new Thread(w);
t.start();
}catch(IOException e){
LOGGER.log(Level.SEVERE, "Error in server accept", e);
}
}
}
}

Event Timeline