Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.net.ServerSocket;
import java.net.Socket;
import java.util.zip.GZIPInputStream;

public class Main {
    public static void main(String[] args) throws Exception {
        ServerSocket ssock = new ServerSocket(Integer.parseInt(args[0]));
        Socket sock = ssock.accept();
        GZIPInputStream zip = new GZIPInputStream(sock.getInputStream());
        while (true) {
            int c;
            c = zip.read();
            if (c == -1)
                break;
            System.out.print((char) c);
        }
    }
}