Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.DataOutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Main {
    public static void main(String args[]) throws Exception {
        ServerSocket ssock = new ServerSocket(1234);
        while (true) {
            System.out.println("Listening");
            Socket sock = ssock.accept();

            DataOutputStream dstream = new DataOutputStream(sock.getOutputStream());
            dstream.writeFloat(3.14159265f);
            dstream.close();
            sock.close();
        }
    }
}