示例#1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="routePath">Call method path, ex:className.method</param>
 /// <param name="param"></param>
 /// <param name="callback"></param>
 public void Call(string routePath, RequestParam param, Action<RemotePackage> callback)
 {
     _msgId++;
     param["MsgId"] = _msgId;
     param["route"] = routePath;
     param["Sid"] = _sessionId;
     param["Uid"] = _userId;
     param["ActionId"] = 0;
     param["ssid"] = _proxySessionId;
     param["isproxy"] = true;
     param["proxyId"] = _proxyId;
     string post = string.Format("d={0}", HttpUtility.UrlEncode(param.ToPostString()));
     if (_client.IsSocket)
     {
         post = "?" + post;
     }
     var responsePack = new RemotePackage { MsgId = _msgId, RouteName = routePath };
     responsePack.Callback += callback;
     PutToWaitQueue(responsePack);
     _client.Send(post);
 }
示例#2
0
        public void SendRequestMaxUsers(RemoteService tcpRemote)
        {
            RequestParam param = new RequestParam();
            param.Add("ServerID", 1);
            tcpRemote.Call("ServerRequestMaxUsers", param, p =>
            {
                Trace.WriteLine("call1:"+p.RouteName);
            });

            param = new RequestParam();
            param.Add("ServerID", 2);
            param.Add("ID", 2);
            tcpRemote.Call("ServerRequestMaxUsers", param, p =>
            {
                Trace.WriteLine("call2:"+ p.RouteName);
            });
        }
示例#3
0
 private void InitClient()
 {
     try
     {
         if (_client is SocketRemoteClient)
         {
             var client = _client as SocketRemoteClient;
             RequestParam heartParam = new RequestParam();
             heartParam["ActionId"] = (int)ActionEnum.Heartbeat;
             string post = string.Format("?d={0}", HttpUtility.UrlEncode(heartParam.ToPostString()));
             client.HeartPacket = Encoding.ASCII.GetBytes(post);
         }
     }
     catch
     {
     }
 }
示例#4
0
 private void InitClient()
 {
     try
     {
         if (_client is SocketRemoteClient)
         {
             var client = _client as SocketRemoteClient;
             RequestParam heartParam = new RequestParam();
             heartParam["ActionId"] = 0;
             string post = heartParam.ToPostString();
             client.HeartPacket = Encoding.ASCII.GetBytes(post);
         }
     }
     catch
     {
     }
 }