Darano

Untitled

Mar 12th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. public class TCPServer {
  2.  
  3.     public static void main(String args[]) throws IOException {
  4.         ServerSocket server = new ServerSocket(5020);
  5.         Socket client = null;
  6.  
  7.         while (true){
  8.                 client = server.accept();
  9.                 Thread t = new ClientThread(client);
  10.                 t.start();
  11.         }
  12.     }
  13. }
  14. class ClientThread extends Thread {
  15.     private Socket client;
  16.  
  17.     public ClientThread(Socket client){
  18.         this.client = client;
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment