TCPMultiServer.java 462 Bytes
Newer Older
Gabriele Civitarese's avatar
Gabriele Civitarese committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
import java.io.*; 
import java.net.*; 

class TCPMultiServer { 

	public static void main(String argv[]) throws Exception 
	{ 
		ServerSocket welcomeSocket = new ServerSocket(6789); 

		while(true) {   
			Socket connectionSocket = welcomeSocket.accept(); 

			/* Creazione di un thread e passaggio della established socket */
			TCPServerThread theThread =  
				new TCPServerThread(connectionSocket);

			/* Avvio del thread */
			theThread.start();
		} 
	} 
}