Esempio n. 1
0
        private void SendReceiveConfirmationMessage(int refNo, IPAddress remoteIP)
        {
            if (remoteIP == null || remoteIP == IPAddress.None)
            {
                return;
            }
            IPEndPoint receiverEndPoint = new IPEndPoint(remoteIP, MulticastGroupIpEndPoint.Port);

            Message message = new ReceiveConfirmationMessage(refNo);

            Socket udpSocket = SocketHelper.GetUdpSocketForSender();

            SendMessage(udpSocket, receiverEndPoint, message);
        }
Esempio n. 2
0
        private void ProcessMessage(Message message, IPAddress remoteIP)
        {
            if (message == null || message.HeaderData == null)
            {
                return;
            }
            switch (message.HeaderData.MsgDataType)
            {
            case EMsgDataType.Signon:
            {
                SignonManager.SignonMgr.ProcessSignonMessage(remoteIP, message.HeaderData.IsReply);
            }
            break;

            case EMsgDataType.ReceiveConfirmation:
            {
                if ((message is ReceiveConfirmationMessage) == false)
                {
                    break;
                }
                ReceiveConfirmationMessage receiveConfirmationMessage = message as ReceiveConfirmationMessage;
                if (receiveConfirmationMessage == null)
                {
                    break;
                }
                if (ReceivedConfirmationList == null)
                {
                    ReceivedConfirmationList = new List <int>();
                }
                lock (ReceivedConfirmationList)
                {
                    ReceivedConfirmationList.Add(receiveConfirmationMessage.ReceiveConfirmRefNo);
                }
            }
            break;

            case EMsgDataType.UserInfo:
            {
                if ((message is UserInfoMessage) == false || remoteIP == IPAddress.None)
                {
                    break;
                }
                UserInfoMessage userInfoMessage = message as UserInfoMessage;
                if (userInfoMessage == null || userInfoMessage.UserInfo == null)
                {
                    break;
                }
                userInfoMessage.UserInfo._IPAddress = remoteIP.ToString();
                SignonManager.SignonMgr.ProcessUserInfoMessage(userInfoMessage.UserInfo, remoteIP, message.HeaderData.IsReply);
            }
            break;

            case EMsgDataType.Text:
            {
                if ((message is TextMessage) == false || remoteIP == IPAddress.None)
                {
                    break;
                }
                TextMessage textMessage = message as TextMessage;
                if (textMessage == null)
                {
                    break;
                }
                textMessage.TextMessageData._IPAddress   = remoteIP.ToString();
                textMessage.TextMessageData._ReceiptTime = DateTime.Now;
                ProcessTextMessage(textMessage.TextMessageData);
            }
            break;
            }
        }
        private void SendReceiveConfirmationMessage(int refNo, IPAddress remoteIP)
        {
            if (remoteIP == null || remoteIP == IPAddress.None)
            {
                return;
            }
            IPEndPoint receiverEndPoint = new IPEndPoint(remoteIP, MulticastGroupIpEndPoint.Port);

            Message message = new ReceiveConfirmationMessage(refNo);

            Socket udpSocket = SocketHelper.GetUdpSocketForSender();

            SendMessage(udpSocket, receiverEndPoint, message);
        }