Beispiel #1
0
        private void appVideoAcceptHandler()
        {
            if (OnServerLog != null)
            {
                OnServerLog("\n<< VideoAccept数据处理 >>");
            }
            int    neckLen  = (int)(Encoding.UTF8.GetChars(data, 1, 1)[0]);
            String neckname = Encoding.UTF8.GetString(data, 2, neckLen);
            int    sendPort = (int)(Encoding.UTF8.GetChars(data, 2 + neckLen, 4)[0]);
            int    spLen    = Encoding.UTF8.GetByteCount(((char)sendPort).ToString());
            int    recvPort = (int)(Encoding.UTF8.GetChars(data, 2 + neckLen + spLen, 4)[0]);

            ChaitMirror targetClient = ChaitServer.Instance.Clients[neckname];
            String      ip           = ClientIP.Split(new char[] { ':' })[0];
            String      msgStr       =
                System.Convert.ToChar(CProtocol.VideoAccept).ToString() +
                ((char)Encoding.UTF8.GetBytes(ClientNeck).Length).ToString() +
                ClientNeck +
                ((char)Encoding.UTF8.GetBytes(ip).Length).ToString() +
                ip +
                ((char)sendPort).ToString() +
                ((char)recvPort).ToString();

            targetClient.transSendMsg(msgStr);
            if (OnServerLog != null)
            {
                OnServerLog(String.Format("{0}接受了{1}的视频聊天请求", ClientNeck, neckname));
            }

            if (OnServerLog != null)
            {
                OnServerLog("\n");
            }
        }