Exemplo n.º 1
0
 public KFClient(AutoCSer.Net.TcpStaticServer.Client client, AutoCSer.Net.TcpInternalServer.ServerAttribute attribute, KuaFuClientContext clientInfo, Action <KFCallManager.KFClient> onSetSocket)
 {
     this._Attribute  = attribute;
     this.OnSetSocket = onSetSocket;
     this.tcpClient   = client;
     this.tcpClient.OnSetSocket(delegate(ClientSocketBase socket)
     {
         if (socket.IsSocketVersion(ref this._Socket))
         {
             this.OnSetSocket(this);
         }
     });
 }
Exemplo n.º 2
0
        private static void NewKFClient(string host, int port)
        {
            AutoCSer.Net.TcpInternalServer.ServerAttribute attribute = new AutoCSer.Net.TcpInternalServer.ServerAttribute();
            attribute.IsAutoClient            = true;
            attribute.Host                    = host;
            attribute.Port                    = port;
            attribute.ServerSendBufferMaxSize = 33554432;
            attribute.ClientSendBufferMaxSize = 4194304;
            KuaFuClientContext clientInfo = new KuaFuClientContext();

            clientInfo.ServerId      = GameManager.ServerId;
            clientInfo.Token         = GameCoreInterface.getinstance().GetLocalAddressIPs();
            KFCallManager.Host       = host;
            KFCallManager.Port       = port;
            KFCallManager.ClientInfo = clientInfo;
            AutoCSer.Net.TcpStaticServer.Client tcpClient = KfCall.NewTcpClient(attribute, null, MyLogAdapter.GetILog(), new Func <AutoCSer.Net.TcpInternalServer.ClientSocketSender, bool>(KFCallManager.verifyMethod));
            KFCallManager.Current = new KFCallManager.KFClient(tcpClient, attribute, clientInfo, new Action <KFCallManager.KFClient>(KFCallManager.OnSetSocket));
            tcpClient.TryCreateSocket();
        }