Exemplo n.º 1
0
        protected override void DiscoverServer(IPEndPoint endPoint, string content)
        {
            RemoteDeviceInfo deviceInfo = null;

            deviceInfo = SimpleJsonUtils.FromJson <RemoteDeviceInfo>(content);
            if (deviceInfo == null)
            {
                deviceInfo         = new RemoteDeviceInfo();
                deviceInfo.appName = content;
            }
            discoveryPeersHandler.Add(deviceInfo, endPoint);
            //Debug.Log("DiscoverServer:" + endPoint + " Centent:" + content);
        }
Exemplo n.º 2
0
        public void Send <T>(T messageData, bool isLog = true) where T : new()
        {
            if (isLog)
            {
                Debug.Log("Send Msg:" + SimpleJsonUtils.ToJson(messageData));
            }

            if (IsConnected)
            {
                SendData(ConnectionId, messageData);
            }
            else
            {
                if (LogInfo)
                {
                    Debug.LogError("Client not Connected!");
                }
            }
        }