Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.ObjectOutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Hashtable;

public class Main {
    public static void main(String args[]) throws Exception {
        ServerSocket ssock = new ServerSocket(1234);
        Hashtable hash = new Hashtable();
        hash.put("A", "a");

        while (true) {
            Socket sock = ssock.accept();
            ObjectOutputStream ostream = new ObjectOutputStream(sock.getOutputStream());
            ostream.writeObject(hash);
            ostream.close();
            sock.close();
        }
    }
}