123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- /*
- * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
- * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
- */
-
- package ChatProgramm.model;
-
- import ChatProgramm.view.ChatView;
- import java.io.IOException;
- import java.net.ServerSocket;
- import java.util.logging.*;
-
- /**
- * Builder Class
- * @author le
- */
- public class Server extends Transmitter
- {
- private static Logger lg = Logger.getLogger("netz");
- private static final int PORT = 35000; //lt. iana port > 2¹⁵
-
-
- public void connect() throws IOException
- {
- try
- {
- ServerSocket sSocket = new ServerSocket(PORT);
- sSocket.setSoTimeout(timeout);
- lg.info("Server: warte auf Verbindung");
- socket = sSocket.accept();
- lg.info("Server: Verbindung akzeptiert");
- }
- catch ( java.io.InterruptedIOException e )
- {
- lg.warning("Timeout"+"("+timeout/1000+"s)");
- }
- }
- public Server(ChatView view) throws IOException {
- super(view);
- connect();
- initIO();
-
-
- }
- }
|