import java.net.*;
import java.io.*;
import java.util.zip.*;

public class CompSend {
  public static void main(String[] args) throws Exception {
    Socket sock=new Socket(args[0],Integer.parseInt(args[1]));
    GZIPOutputStream zip = new GZIPOutputStream(
      sock.getOutputStream());
    String line;
    BufferedReader bis = new BufferedReader(
      new FileReader(args[2]));
    while (true) {
       try {
         line=bis.readLine();
         if (line==null) break;
         line=line+"\n";
         zip.write(line.getBytes(),0,line.length());
         }
       catch (Exception e) { break; }
       }
    zip.finish();
    zip.close();
    sock.close();    
    }
  }
