Esempio n. 1
0
        public void BeginSendTo(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.BeginSend(data, offset, count);
            }
            else
            {
                _log.WarnFormat("Cannot find session [{0}].", session);
            }
        }
Esempio n. 2
0
        public IAsyncResult BeginSendTo(TcpSocketSession session, byte[] data, int offset, int count, AsyncCallback callback, object state)
        {
            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))
            {
                return(session.BeginSend(data, offset, count, callback, state));
            }
            else
            {
                _log.WarnFormat("Cannot find session [{0}].", session);
            }

            return(null);
        }
Esempio n. 3
0
        public void BeginSendTo(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.BeginSend(data, offset, count);
            }
            else
            {
                Logs.Warn(string.Format("Cannot find session [{0}].", sessionKey));
            }
        }