Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package javaapplication2;
  7.  
  8. import java.io.BufferedReader;
  9. import java.io.IOException;
  10. import java.io.InputStreamReader;
  11. import java.io.OutputStream;
  12. import java.io.PrintWriter;
  13. import java.net.*;
  14. import java.util.*;
  15.  
  16. /**
  17. *
  18. * @author STUDENT
  19. */
  20. public class JavaApplication2 {
  21.  
  22. /**
  23. * @param args the command line arguments
  24. */
  25. public static void main(String[] args) throws IOException {
  26.  
  27. ServerSocket serwer = new ServerSocket(8888);
  28. ArrayList<Socket> lista = new ArrayList<Socket>();
  29.  
  30. int i = 0;
  31. while(true)
  32. {
  33. lista.add(new Socket());
  34. Socket pom = lista.get(i);
  35. pom = serwer.accept();
  36. //try(OutputStream os = pom.getOutputStream())
  37. //{
  38. //try(PrintWriter pw = new PrintWriter(os))
  39. //{
  40.  
  41. //pw.println("Witaj na serwerze!");
  42. //pw.flush();
  43. i++;
  44. //}
  45. //}
  46.  
  47. }
  48.  
  49.  
  50.  
  51. }
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement