Blame view

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

import java.util.Scanner;

public class JChat
{
	public static void main(String[] args)
	{
		String ip;
10
		int port, roomSize;
11
		Scanner in = new Scanner(System.in);
12
13
14
15
		System.out.print("IP: ");
		ip = in.nextLine();
		System.out.print("Port: ");
		port = in.nextInt();
16
17
		System.out.print("Size of chatroom: ");
		roomSize = in.nextInt();
18
		in.close();
19
20
21
22
23
		final Server serv = new Server(ip,port,roomSize);
		Runtime.getRuntime().addShutdownHook(new Thread() 
		{
			public void run() 
			{
24
				System.out.println("JChat: Caught interrupt, killing server...");
25
26
27
	            serv.killServer();
	        }
		});
28
		serv.startServer();
29
30
	}
}