Read float number from a Socket
import java.io.DataInputStream; import java.net.Socket; public class Main { public static void main(String[] args) throws Exception { Socket sock = new Socket(args[0], 1234); DataInputStream dis = new DataInputStream(sock.getInputStream()); float f = dis.readFloat(); System.out.println("PI=" + f); dis.close(); sock.close(); } }