Chat-Applikation/src/server/MainServer.java

39 lines
1 KiB
Java
Raw Normal View History

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package server;
import java.io.*;
import java.net.*;
import java.util.concurrent.ExecutionException;
/**
* Hauptklasse des Servers
*
* @version 0.0.1
* @author eichehome
*/
public class MainServer {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try {
ServerSocket serverSocket = new ServerSocket(1236);
ClientMessageDistributorThread messageDistributor = new ClientMessageDistributorThread();
for (int i = 0; i < 3; i++) {
Socket client = serverSocket.accept();
System.out.println("client connected");
new ServerHandelClientsThread(client, messageDistributor).start();
}
} catch (Exception e) {
System.err.println("Fehler: " + e);
}
}
}