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

            transactionID = GenerateTransactionID();
        }
Beispiel #2
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);
        }