Blame view

JChatServer/src/pad/prac2/JChat.java 758 Bytes
1
2
3
4
5
6
7
8
package pad.prac2;

import java.util.Scanner;

public class JChat
{
	public static void main(String[] args)
	{
9
10
		String ip;
11
		int port, roomSize;
12
		Scanner in = new Scanner(System.in);
13
14
15
16
		System.out.print("IP: ");
		ip = in.nextLine();
		System.out.print("Port: ");
		port = in.nextInt();
17
18
		System.out.print("Size of chatroom: ");
		roomSize = in.nextInt();
19
		in.close();
20
21
		ip = "localhost";
		port = 3001;
22
		roomSize = 2;
23
24
25
26
27
		final Server serv = new Server(ip,port,roomSize);
		Runtime.getRuntime().addShutdownHook(new Thread() 
		{
			public void run() 
			{
28
				System.out.println("JChat: Caught interrupt, killing server...");
29
30
31
	            serv.killServer();
	        }
		});
32
		serv.startServer();
33
	}
34
35
36
	/*
	 * TODO
	 * 
37
	 * room is full
38
	 * CTRL+C
39
	 */
40
}