예제 #1
0
        private void SocketData(int source, int session, string method, byte[] param)
        {
            NetSprotoType.SocketData socketData = new NetSprotoType.SocketData(param);
            long connectionId = socketData.connection;
            byte[] tempParam = Convert.FromBase64String(socketData.buffer);

            SkynetClusterRequest req = m_skynetPacketManager.UnpackSkynetRequest(tempParam);
            if (req == null)
            {
                return;
            }

            NetProtocol instance = NetProtocol.GetInstance();
            int tag = instance.GetTag("RPC");
            RPCParam sprotoRequest = (RPCParam)instance.Protocol.GenRequest(tag, req.Data);
            byte[] targetParam = Convert.FromBase64String(sprotoRequest.param);

            if (req.Session > 0)
            {
                SSContext context = new SSContext();
                context.IntegerDict["RemoteSession"] = req.Session;
                context.LongDict["ConnectionId"] = connectionId;

                Call(req.ServiceName, sprotoRequest.method, targetParam, context, TransferCallback);
            }
            else
            {
                Send(req.ServiceName, sprotoRequest.method, targetParam);
            }
        }
예제 #2
0
        private void SocketData(int source, int session, string method, byte[] param)
        {
            NetSprotoType.SocketData socketData = new NetSprotoType.SocketData(param);
            long connectionId = socketData.connection;

            byte[] tempParam = Convert.FromBase64String(socketData.buffer);

            SkynetClusterResponse response = m_skynetPacketManager.UnpackSkynetResponse(tempParam);

            if (response == null)
            {
                return;
            }

            byte[] targetParam = null;
            if (response.ErrorCode == RPCError.OK)
            {
                NetProtocol instance       = NetProtocol.GetInstance();
                RPCParam    sprotoResponse = (RPCParam)instance.Protocol.GenResponse(response.ProtoId, response.Data);
                targetParam = Convert.FromBase64String(sprotoResponse.param);
            }

            int remoteSession = response.Session;

            ProcessRemoteResponse(remoteSession, targetParam, response.ErrorCode);
        }