2021-05-11 11:59:08 +00:00
|
|
|
/*
|
2021-05-13 19:09:10 +00:00
|
|
|
* Copyright (C) 2021 eichehome
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2021-05-11 11:59:08 +00:00
|
|
|
*/
|
|
|
|
package server;
|
|
|
|
|
2021-05-13 19:09:10 +00:00
|
|
|
import java.io.IOException;
|
2021-05-11 11:59:08 +00:00
|
|
|
import java.net.*;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hauptklasse des Servers
|
|
|
|
*
|
|
|
|
* @version 0.0.1
|
|
|
|
* @author eichehome
|
|
|
|
*/
|
|
|
|
public class MainServer {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param args the command line arguments
|
|
|
|
*/
|
|
|
|
public static void main(String[] args) {
|
2021-05-13 22:25:42 +00:00
|
|
|
try (ServerSocket serverSocket = new ServerSocket(1236)) {
|
2021-05-13 19:09:10 +00:00
|
|
|
ClientMessageStore messageStore = new ClientMessageStore();
|
2021-05-13 22:25:42 +00:00
|
|
|
while (true) {
|
2021-05-11 11:59:08 +00:00
|
|
|
Socket client = serverSocket.accept();
|
|
|
|
System.out.println("client connected");
|
2021-05-13 22:25:42 +00:00
|
|
|
Thread thread = new ServerHandelClientsThread(client, messageStore);
|
|
|
|
System.out.println("Test");
|
|
|
|
thread.run();
|
|
|
|
messageStore.addThread(thread);
|
2021-05-11 11:59:08 +00:00
|
|
|
|
|
|
|
}
|
2021-05-13 19:09:10 +00:00
|
|
|
} catch (Exception ex) {
|
|
|
|
System.err.println("Fehler: " + ex);
|
2021-05-11 11:59:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|