Java tutorial
import java.io.DataInputStream; import java.io.InputStream; import java.net.Socket; class SocketDemo { public static void main(String args[]) throws Exception { String server = args[0]; int port = Integer.parseInt(args[1]); Socket s = new Socket(server, port); InputStream is = s.getInputStream(); DataInputStream dis = new DataInputStream(is); System.out.println(dis.readInt()); s.close(); } }