public void write(OutputStream out) throws SocksException, IOException {
  if (data == null) {
    Socks5Message msg;
    if (addrType == SOCKS_ATYP_DOMAINNAME)     msg=new Socks5Message(command,host,port);
 else {
      if (ip == null) {
        try {
          ip=InetAddress.getByName(host);
        }
 catch (        UnknownHostException uh_ex) {
          throw new SocksException(SocksConstants.SOCKS_JUST_ERROR);
        }
      }
      msg=new Socks5Message(command,ip,port);
    }
    data=msg.data;
  }
  out.write(data);
}

public void write ( OutputStream out ) throws SocksException , IOException { if ( data == null ) { Socks5Message msg ; if ( addrType == SOCKS_ATYP_DOMAINNAME ) msg = new Socks5Message ( command , host , port ) ; else { if ( ip == null ) { try { ip = InetAddress . getByName ( host ) ; } catch ( UnknownHostException uh_ex ) { throw new SocksException ( SocksConstants . SOCKS_JUST_ERROR ) ; } } msg = new Socks5Message ( command , ip , port ) ; } data = msg . data ; } out . write ( data ) ; }
writes the message to the stream .
