Search in sources :

Example 1 with BowlerUDPServer

use of com.neuronrobotics.sdk.network.BowlerUDPServer in project java-bowler by NeuronRobotics.

the class BowlerAbstractServer method startNetworkServer.

public void startNetworkServer(final int port) throws IOException {
    udpServer = new BowlerUDPServer(port);
    serverSocket = new ServerSocket(port + 1);
    new Thread() {

        public void run() {
            setName("Bowler Platform Network Server");
            addServer(udpServer);
            while (true) {
                Socket s;
                try {
                    // ex.printStackTrace();
                    Log.warning("\n\nWaiting for UDP connection on port " + (port) + "...");
                    Log.warning("\n\nWaiting for TCP connection on port " + (port + 1) + "...");
                    s = serverSocket.accept();
                    addServer(new BowlerTCPServer(s));
                    Log.warning("Got a connection!");
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }.start();
}
Also used : BowlerUDPServer(com.neuronrobotics.sdk.network.BowlerUDPServer) BowlerTCPServer(com.neuronrobotics.sdk.network.BowlerTCPServer) ServerSocket(java.net.ServerSocket) IOException(java.io.IOException) Socket(java.net.Socket) ServerSocket(java.net.ServerSocket)

Aggregations

BowlerTCPServer (com.neuronrobotics.sdk.network.BowlerTCPServer)1 BowlerUDPServer (com.neuronrobotics.sdk.network.BowlerUDPServer)1 IOException (java.io.IOException)1 ServerSocket (java.net.ServerSocket)1 Socket (java.net.Socket)1