Advertisement
Gustavo_Inzunza

ServidorM

Jun 2nd, 2013
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import java.net.*;
  2. import java.io.*;
  3.  
  4. public class ServidorM
  5. {
  6. public static void main(String[] args) throws IOException
  7. {
  8. ServerSocket Master = null;
  9. boolean escucha = true;
  10. int contador=1;
  11. try
  12. {
  13. Master = new ServerSocket(9876);//crea un server socket
  14. }
  15. catch (IOException e)
  16. {
  17. System.err.println("No puedo Utilizar el puerto 9876");
  18. System.exit(-1);
  19. }
  20. while (escucha)
  21. {
  22. new ServidorHijo(Master.accept(),contador).start();//inicia una nueva hebra
  23. contador++;
  24. }
  25. Master.close();
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement