Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. import java.io.IOException;
  2. import java.io.PrintWriter;
  3. import java.net.ServerSocket;
  4. import java.net.Socket;
  5.  
  6. public class p1 extends Thread{
  7.    
  8.    
  9.     public static void main(String[] args) throws InterruptedException {
  10.        
  11.         try {
  12.            
  13.             ServerSocket sock=new ServerSocket(6013);
  14.            
  15.             while(true)
  16.             {
  17.                 Socket client=sock.accept();
  18.                
  19.                 PrintWriter port =new PrintWriter(client.getOutputStream(),true);
  20.                 port.println(new java.util.Date().toString());
  21.                 client .close();
  22.             }
  23.            
  24.         }catch(IOException e) {
  25.             System.out.println("ERROR");
  26.         }
  27.        
  28.        
  29.                
  30.  
  31.     }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement