MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.io.IOException;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class MainClass {

    public static void main(String[] args) throws Exception {

        int port = 37;
        ServerSocket server = new ServerSocket(port);
        while (true) {
            Socket connection = null;
            connection = server.accept();
            OutputStream out = connection.getOutputStream();
            out.write(123);
            out.flush();
            connection.close();
        }
    }

}