Пример #1
0
        public void Send(string identifier, byte[] data, int offset, int count)
        {
            if (this.Identifier != identifier)
            {
                throw new InvalidOperationException(
                          string.Format("Channel identifier is not matched, Identifier[{0}].", identifier));
            }

            _innerSession.Send(data, offset, count);
            _keepAliveTracker.OnDataSent();
        }
Пример #2
0
        public void Send(string actorType, string actorName, byte[] data, int offset, int count)
        {
            var actorKey = ActorIdentity.GetKey(actorType, actorName);

            if (_remoteActor == null)
            {
                throw new InvalidOperationException(
                          string.Format("The remote actor has not been connected, Type[{0}], Name[{1}].", actorType, actorName));
            }
            if (_remoteActor.GetKey() != actorKey)
            {
                throw new InvalidOperationException(
                          string.Format("Remote actor key not matched, [{0}]:[{1}].", _remoteActor.GetKey(), actorKey));
            }

            _connector.Send(data, offset, count);
            _keepAliveTracker.OnDataSent();
        }