Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.net.*;
- import java.io.*;
- public class ServidorM
- {
- public static void main(String[] args) throws IOException
- {
- ServerSocket Master = null;
- boolean escucha = true;
- int contador=1;
- try
- {
- Master = new ServerSocket(9876);//crea un server socket
- }
- catch (IOException e)
- {
- System.err.println("No puedo Utilizar el puerto 9876");
- System.exit(-1);
- }
- while (escucha)
- {
- new ServidorHijo(Master.accept(),contador).start();//inicia una nueva hebra
- contador++;
- }
- Master.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement