コード例 #1
0
        /// <summary>
        /// 创建一个远程服务器的数据推送操作,以便推送给子客户端
        /// </summary>
        /// <param name="ipAddress">远程的IP地址</param>
        /// <param name="port">远程的端口号</param>
        /// <param name="key">订阅的关键字</param>
        public OperateResult CreatePushRemote(string ipAddress, int port, string key)
        {
            OperateResult result;

            hybirdLock.Enter( );


            if (pushClients.Find(m => m.KeyWord == key) == null)
            {
                NetPushClient pushClient = new NetPushClient(ipAddress, port, key);
                result = pushClient.CreatePush(GetPushFromServer);
                pushClients.Add(pushClient);
            }
            else
            {
                result = new OperateResult( )
                {
                    Message = "当前的关键字已经存在。"
                };
            }

            hybirdLock.Leave( );

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 创建一个远程服务器的数据推送操作,以便推送给子客户端
        /// </summary>
        /// <param name="ipAddress">远程的IP地址</param>
        /// <param name="port">远程的端口号</param>
        /// <param name="key">订阅的关键字</param>
        public OperateResult CreatePushRemote(string ipAddress, int port, string key)
        {
            OperateResult result;

            hybirdLock.Enter( );


            if (pushClients.Find(m => m.KeyWord == key) == null)
            {
                NetPushClient pushClient = new NetPushClient(ipAddress, port, key);
                result = pushClient.CreatePush(GetPushFromServer);
                pushClients.Add(pushClient);
            }
            else
            {
                result = new OperateResult(StringResources.Language.KeyIsExistAlready);
            }

            hybirdLock.Leave( );

            return(result);
        }