Esempio n. 1
0
        public void OnResponse(byte[] buffer, long offset, long size)
        {
            SignalingClientMessage ssM = new SignalingClientMessage();

            if (!ssM.FromBuffer(buffer, offset, size))
            {
                return;
            }
            bool status;

            switch (ssM.methodType)
            {
            case SignalingMethod.CreateRoomResponse:
                status = ssM.Get(SignalingAttribute.Success) == null ? false : true;
                OnCreateRoomResponseEvent?.Invoke(this, new NATP_SignalingEventArgs(status, ""));
                break;

            case SignalingMethod.JoinRoomResponse:
                status = ssM.Get(SignalingAttribute.Success) == null ? false : true;
                OnJoinRoomResponseEvent?.Invoke(this, new NATP_SignalingEventArgs(status, ""));
                break;

            case SignalingMethod.CloseRoomResponse:
                break;

            case SignalingMethod.ConnectionAttemptResponse:
                OnConnectionAttemptResponse(ssM);
                break;

            case SignalingMethod.GetRoomListResponse:
                OnGetRoomListResponse(ssM);
                break;
            }
        }
Esempio n. 2
0
        private void OnGetRoomListResponse(SignalingClientMessage ssM)
        {
            //List<IPEndPoint> roomlist = (List<IPEndPoint>)ssM.Get(SignalingAttribute.RoomAddress);
            List <Room> roomList = (List <Room>)ssM.Get(SignalingAttribute.Room);

            OnGetRoomListResponseEvent?.Invoke(this, new NATP_SignalingEventArgs(true, roomList));
        }
Esempio n. 3
0
        private void OnConnectionAttemptResponse(SignalingClientMessage ssM)
        {
            IPEndPoint peer = (IPEndPoint)ssM.Get(SignalingAttribute.PeerAddress);

            OnConnectionAttemptResponseEvent?.Invoke(this, new NATP_SignalingEventArgs(true, "", peer));
        }