Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. import java.net.ServerSocket;
  2. import java.util.concurrent.ExecutorService;
  3. import java.util.concurrent.Executors;
  4.  
  5. public class Server {
  6.  
  7.     private static final String MESSAGE = "tohle posli zpet";
  8.  
  9.     public static void main(String[] args) {
  10.         try {
  11.             ExecutorService threadPool = Executors.newCachedThreadPool();
  12.             ServerSocket server = new ServerSocket(12345);
  13.  
  14.             while (true) {
  15.                 Vlakno vlakno = new Vlakno(server.accept());
  16.                 threadPool.execute(vlakno);
  17.             }
  18.  
  19.         } catch (Exception e) {
  20.             System.err.println(e.getMessage());
  21.         }
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement