private void write() throws IOException {
    // port
    if(auxport){
      ServerSocket foo=new ServerSocket(0);
      String snum=(new Integer(foo.getLocalPort())).toString();
      byte[] array=snum.getBytes();

      out.write(array, 0, array.length);
      out.write(0);
      out.flush();

      auxsocket=foo.accept();
      auxin=auxsocket.getInputStream();
      auxout=auxsocket.getOutputStream();

      try{
        foo.close();
      }
      catch(Exception ee){System.out.println("ee: "+ee);}
    }
    else{
      out.write(0);
    }

    int chop=16;
    if(user.length()<chop) chop=user.length();
    out.write(user.getBytes(), 0, chop);
    out.write(0);

    chop=16;
    if(passwd.length()<chop) chop=passwd.length();
    out.write(passwd.getBytes(), 0, chop);
    out.write(0);

    chop=4096;
    if(command.length()<chop) chop=command.length();
    out.write(command.getBytes(), 0, chop);
    out.write(0);

    if(data!=null){
      byte[] buf=new byte[1024];
      while(true){
        int len=data.read(buf, 0, buf.length);
	if(len==-1) break;
	out.write(buf, 0, len);
      }
    }
  }