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.Warning("Cannot find session [{0}].", session);
            }

            return(null);
        }
        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.Warning("Cannot find session [{0}].", session);
            }
        }