// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.*;
import java.net.*;

public class Server {
   public static void main(String[] args) throws Exception {
      ServerSocket ss = new ServerSocket(9999);
      Socket s = ss.accept();
      InputStream is = s.getInputStream();
      OutputStream os = new FileOutputStream("C:\\z2.zip");
      byte[] b = new byte[10000];
      int n;
      while((n = is.read(b)) >= 0) {
         os.write(b, 0, n);
      }
      os.close();
      is.close();
   }
}
