Package de.dwerth.gntpserver.run

Source Code of de.dwerth.gntpserver.run.MainServer

package de.dwerth.gntpserver.run;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

import de.dwerth.gntpserver.gntp.InputThread;

public class MainServer {

  public final static int PORT = 23054;

  public static void main(String[] args) {
    ServerSocket server = null;
    try {
      server = new ServerSocket(PORT);
      // wait for Connections
      System.out.println("server fully up and running");
      while (true) {
        Socket s = server.accept();
        System.out.println("new connection from " + s.getInetAddress());
        InputThread ct = new InputThread(s);
        ct.start();
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (server != null) {
        try {
          server.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }

  }
}
TOP

Related Classes of de.dwerth.gntpserver.run.MainServer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.