예제 #1
0
        public STUNClient(NetworkProtocol p)
        {
            protocol = p;
            protocol.AttachResponseListener(ChannelType.STUN, OnResponse);
            protocol.AttachErrorListener(NetworkErrorType.ErrorNoResponseSTUN, OnError);

            transactionID = GenerateTransactionID();
        }
예제 #2
0
 public NetworkPeer(NetworkProtocol p)
 {
     protocol = p;
     for (int i = 0; i < (int)ChannelType.LAST; i++)
     {
         messageSequence.Add(0);
     }
 }
예제 #3
0
        public void AttachToProtocol(NetworkProtocol p)
        {
            local = new NetworkPeer(p);

            protocol = p;
            protocol.OnReadHeader  += OnReadHeader;
            protocol.OnWriteHeader += OnWriteHeader;
            protocol.AttachRequestListener(ChannelType.Server, OnRequestConnectToServer);
            protocol.AttachResponseListener(ChannelType.Server, OnResponseConnectToServer);
            protocol.AttachErrorListener(NetworkErrorType.ErrorConnectToServer, OnErrorConnectToServer);

            //local.id = 0;// ServerGeneratePeerId(protocol.socket.sendSocket.LocalEndPoint);
        }