Ejemplo n.º 1
0
 /// <summary>
 /// User request some custom data, e.g. udp server port
 /// </summary>
 public void HRequestCustomData(TcpMessage Request)
 {
     CCommon.CustomData cData = (CCommon.CustomData)Request.State;
     if (!CustomData.ContainsKey(cData))
     {
         return;
     }
     SendRequest(Users[Request.From].EndPoint,
                 new RequestCustomData(Request.From, cData, CustomData[cData]).GetBytes());
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Handle receiving custom data from server
        /// </summary>
        void ChatClient_OnCustomData(CCommon.CustomData customData, string Data)
        {
            switch (customData)
            {
            case CCommon.CustomData.RequestUdpPort:
                try
                {
                    int port = Int32.Parse(Data);
                    UdpServer = new IPEndPoint(Server.Address, port);
                }
                catch { }
                break;

                // Add new cases of CustomData
            }
        }