Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void connect(InetAddress remoteAddress, int remotePort) throws IOException, SocketTimeoutException {
- this.remoteAddress = remoteAddress.getHostAddress();
- this.remotePort = remotePort;
- KtnDatagram syn = this.constructPacket(KtnDatagram.SYN, "heisann");
- state = SYN_SENT;
- KtnDatagram synAck = this.sendPacket(syn);
- if (synAck != null) {
- state = ESTABLISHED;
- this.remoteAddress = synAck.getSrc_addr();
- this.remotePort = synAck.getSrc_port();
- state=ESTABLISHED;
- this.sendAck(synAck, KtnDatagram.ACK);
- } else {
- state = CLOSED;
- }
- }
Add Comment
Please, Sign In to add comment