You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
492 B
Java
24 lines
492 B
Java
import java.net.ServerSocket;
|
|
import java.net.Socket;
|
|
|
|
public class ServeurTCP {
|
|
public static void main(String args[]) throws Exception {
|
|
// Create a server socket listening on TCP/6017
|
|
ServerSocket ssg = new ServerSocket(6017);
|
|
|
|
while(true) {
|
|
// Waiting for a connection then accept
|
|
Socket csocket = ssg.accept();
|
|
|
|
//create a object Tqotd who will run in a thread
|
|
Tqotd a = new Tqotd(csocket);
|
|
Thread t = new Thread(a);
|
|
//start the thread
|
|
t.start();
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|