Mega Code Archive

 
Categories / Java / Network Protocol
 

Get the Date from server

import java.io.InputStream; import java.net.Socket; public class Main {   public static void main(String args[]) throws Exception{     Socket s = new Socket(args[0], 13);     InputStream is = s.getInputStream();     while (true) {       byte b[] = new byte[100];       int i = is.read(b);       if (i == -1)         break;       System.out.print(new String(b, 0, i));     }   } }