Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.net.ServerSocket;
- import java.util.concurrent.ExecutorService;
- import java.util.concurrent.Executors;
- public class Server {
- private static final String MESSAGE = "tohle posli zpet";
- public static void main(String[] args) {
- try {
- ExecutorService threadPool = Executors.newCachedThreadPool();
- ServerSocket server = new ServerSocket(12345);
- while (true) {
- Vlakno vlakno = new Vlakno(server.accept());
- threadPool.execute(vlakno);
- }
- } catch (Exception e) {
- System.err.println(e.getMessage());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement