public String openSEND() throws IOException{
        Transporte t = new Transporte(initTransporteACKeSYN);
        Transporte t1 = new Transporte(initTransporteACKeSYN);
        
        seq = 0; //numero de sequencia por defeito para o cliente
        mtu = 1400;
        win = MINWIN;
        
     //criar SYN (dados = porta que recebe)
        t.createTransportePacket("SYN", 0, 2, win, mtu, seq, 0, Transporte.intToByte(this.receiveSocket.getLocalPort(), 2));
        Console_println(t.toString()); //teste
        
        
        
     //envia SYN e espera por SYN_ACK   
        RTT = RTT_INIT;
        do{ RTT--;
            t.enviarTransporte(this.sendSocket, this.sendIPAddress, this.sendPort);
            Console_println(">SYN enviado"+ " para "+this.sendIPAddress.getHostAddress()+":"+this.sendPort);

            this.iniciar_smallTimeOut(boundedB,timeout,SMALLTIMEOUT_OPEN*4);
            
            Console_println(">a espera de SYN_ACK");
            
            t1 = recebeuACKde(t, this.sendIPAddress);
            if(timeout.value==1) Console_println("timeout");
            if(RTT<0) return rtt_error;
        }while(timeout.value==1 || t1==null);
        
        this.sendPort = Transporte.byteToInt(t1.getDados(),2); //muda a porta de envio
        
        Transporte syn = (Transporte) t.clone(); //cria copia do SYN
        
     //criar ACK (size=1) de SYN_ACK
        
        int x = Transporte.byteToInt(t1.getSeq(), 2) + 1;  //num_seq(SYN_ACK) + 1
        t.createTransportePacket("ACK", 0, 1, win, mtu, seq, x, new byte[1]);
        Console_println(t.toString()); //teste
        
        
     //envia ACK (size=1) de SYN_ACK
        RTT = RTT_INIT;
        do{ RTT--;
            t.enviarTransporte(this.sendSocket, this.sendIPAddress, this.sendPort);
            
            Console_println(">ACK enviado");
            
            this.iniciar_smallTimeOut(boundedB,timeout,SMALLTIMEOUT_OPEN2); //timeout superior ao do outro terminal
            
            Console_println(">a espera de SYN_ACK repetido");
            
            t1 = recebeuACKde(syn, this.sendIPAddress);
            if(timeout.value==1) Console_println("timeout");
            if(RTT<0) return rtt_error;
        }while(t1!=null && timeout.value==0);
        
        return sucesso;
   }