Example #1
0
        private void GetDeviceList()
        {
            var manageList = (from item in SocketServer.WebSocket.devicePool
                              select item.Value).ToList();

            Response.Write(manageList.ToJson());
            Response.End();
            json = null;
        }
        private void GetAllSocketList()
        {
            var manageList = (from item in TcpServer.WebSocketHelper.clientPool
                              select new { id = item.Value.Name, handle = item.Value.handle.ToString() }).ToList();

            Response.Write(manageList.ToJson());
            Response.End();
            json = null;
        }
Example #3
0
        private void GetManageList()
        {
            var manageList = (from item in SocketServer.WebSocket.manageInfoPool
                              select new {
                                  onLineTime = item.Value.onLineTime,
                                  userName=item.Value.userName,
                                  handle=item.Key.Handle.ToString(),
                                  ip=item.Key.RemoteEndPoint.ToString()
                              }
                            ).ToList();

            Response.Write(manageList.ToJson());
            Response.End();
            json = null;
        }
Example #4
0
        private void DeviceGoOnLine()
        {
            string deviceSN = socketContext.GetJsonValue("DeviceSN");
            DeviceInfo clientInfo = new DeviceInfo()
            {
                deviceSN=deviceSN,
                onLineTime=DateTime.Now
            };

            devicePool.Add(curClientSocket,clientInfo);

            mJsonResult json = new mJsonResult()
            {
                success = true,
                msg=string.Format("上线成功,上线时间:{0}",DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                clientPostType = "retDeviceGoOnLine"
            };

            SocketMessage sm = new SocketMessage()
            {
                Message = json.ToJson(),
                SendToClients=new Dictionary<Socket,ClientInfo>(){{curClientSocket,null}}
            };
            msgPool.Add(sm);

            //设备上线 推送给所有管理页面
            GetOnlineDeviceList();
        }
Example #5
0
        private void ManageGoOnLine()
        {
            string userName = socketContext.GetJsonValue("userName");
            ManageInfo clientInfo = new ManageInfo()
            {
                userName = userName,
                onLineTime = DateTime.Now
            };

            manageInfoPool.Add(curClientSocket, clientInfo);

            mJsonResult json = new mJsonResult()
            {
                success = true,
                msg = string.Format("上线成功,上线时间:{0}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                clientPostType = "retManageGoOnLine"
            };

            SocketMessage sm = new SocketMessage()
            {
                Message = json.ToJson(),
                SendToClients = new Dictionary<Socket, ClientInfo>() { { curClientSocket, null } }
            };
            msgPool.Add(sm);
        }
Example #6
0
        private void GetOnlineManageList()
        {
            var manageList = (from item in manageInfoPool
                              select item.Value).ToList();

            mJsonResult json = new mJsonResult()
            {
                success = true,
                rows = manageList,
                clientPostType = "retGetOnlineManageList"
            };

            //推送给所有连接的管理页面
            Dictionary<Socket, ClientInfo> sendto = (
                from a in manageInfoPool
                select new KeyValuePair<Socket, ClientInfo>(a.Key, null)
                ).ToDictionary(key => key.Key, value => value.Value);

            SocketMessage sm = new SocketMessage()
            {
                Message = json.ToJson(),
                SendToClients = sendto
            };
            msgPool.Add(sm);
        }