/// <summary> /// 2nd handshake for connect /// </summary> /// <param name="hs"></param> protected void sendConfirmation(ConnectionHandshake hs) { try { ConnectionHandshake handshake = new ConnectionHandshake(); handshake.setConnectionType(-1); handshake.setSocketType(ConnectionHandshake.SOCKET_TYPE_DGRAM); handshake.setInitialSeqNo(hs.getInitialSeqNo()); handshake.setPacketSize(hs.getPacketSize()); handshake.setSocketID(mySocketID); handshake.setMaxFlowWndSize(flowWindowSize); handshake.setSession(this); Log.Write(this.ToString(), "Sending confirmation " + handshake.toString()); endPoint.doSend(handshake); } catch (Exception exc) { Log.Write(this.ToString(), exc); } }
/// <summary> /// handshake for connect /// </summary> protected void sendHandShake() { try { ConnectionHandshake handshake = new ConnectionHandshake(); handshake.setConnectionType(ConnectionHandshake.CONNECTION_TYPE_REGULAR); handshake.setSocketType(ConnectionHandshake.SOCKET_TYPE_DGRAM); long initialSequenceNo = SequenceNumber.random(); setInitialSequenceNumber(initialSequenceNo); handshake.setInitialSeqNo(initialSequenceNo); handshake.setPacketSize(getDatagramSize()); handshake.setSocketID(mySocketID); handshake.setMaxFlowWndSize(flowWindowSize); handshake.setSession(this); Log.Write(this.ToString(), "Sending " + handshake); endPoint.doSend(handshake); } catch (Exception exc) { Log.Write(this.ToString(), exc); } }