JChat.java
808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package pad.prac2;
import java.util.Scanner;
public class JChat
{
public static void main(String[] args)
{
String ip;
int port, roomSize;
/*Scanner in = new Scanner(System.in);
System.out.print("IP: ");
ip = in.nextLine();
System.out.print("Port: ");
port = in.nextInt();
System.out.print("Size of chatroom: ");
roomSize = in.nextInt();
in.close();*/
ip = "localhost";
port = 3001;
roomSize = 3;
final Server serv = new Server(ip,port,roomSize);
Runtime.getRuntime().addShutdownHook(new Thread()
{
public void run()
{
System.out.println("JChat: interrupt catched, killing server...");
serv.killServer();
}
});
serv.startServer();
}
/*
* TODO
*
* unicast message
* list nicks
* disconnect/reconnect successfully
*/
}