Advertisement
Guest User

Untitled

a guest
May 25th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. package Quiz_Server;
  2.  
  3. import java.net.*;
  4. import java.io.*;
  5.  
  6. /*public ServerSocket(int port, int backlog) throws IOException
  7. Similar to the previous constructor, the backlog parameter specifies
  8. how many incoming clients to store in a wait queue.*/
  9.  
  10.  
  11. public class Server
  12. {
  13.    public static final int PORT=4444;
  14.    
  15.    
  16.    public void runServer() throws IOException, ClassNotFoundException
  17.    {
  18.       ServerSocket serverSocket = new ServerSocket(PORT);
  19.       System.out.println("Serwer czeka na klientow");
  20.      
  21.       while(true){
  22.           Socket socket = serverSocket.accept();
  23.           new ServerThread(socket).start();
  24.       }
  25.  
  26.    }
  27.  
  28.  
  29. public static void main(String[] args ) throws IOException, ClassNotFoundException {
  30.        new Server().runServer();
  31.    }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement