Example #1
0
        public void SendTo(string sessionKey, byte[] data, int offset, int count)
        {
            GuardRunning();

            if (string.IsNullOrEmpty(sessionKey))
            {
                throw new ArgumentNullException("sessionKey");
            }

            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            TcpSocketSession session = null;

            if (_sessions.TryGetValue(sessionKey, out session))
            {
                session.Send(data, offset, count);
            }
            else
            {
                _log.Warn("Cannot find session [{0}].", sessionKey);
            }
        }
Example #2
0
        public void SendTo(TcpSocketSession session, byte[] data, int offset, int count)
        {
            GuardRunning();

            if (session == null)
            {
                throw new ArgumentNullException("session");
            }

            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            TcpSocketSession writeSession = null;

            if (_sessions.TryGetValue(session.SessionKey, out writeSession))
            {
                session.Send(data, offset, count);
            }
            else
            {
                Logs.Warn(string.Format("Cannot find session [{0}].", session));
            }
        }
Example #3
0
        public void SendTo(TcpSocketSession session, byte[] data, int offset, int count)
        {
            GuardRunning();

            if (session == null)
                throw new ArgumentNullException("session");

            if (data == null)
                throw new ArgumentNullException("data");

            TcpSocketSession writeSession = null;
            if (_sessions.TryGetValue(session.SessionKey, out writeSession))
            {
                session.Send(data, offset, count);
            }
            else
            {
                _log.WarnFormat("Cannot find session [{0}].", session);
            }
        }