Пример #1
0
        protected override TcpSession CreateSession()
        {
            SimpleServerSession session = new SimpleServerSession(this);

            session.Handler = this;

            return(session);
        }
Пример #2
0
        public bool MulticastMessageTo(Guid guid, byte[] dataBytes)
        {
            if (!IsStarted)
            {
                return(false);
            }

            SimpleServerSession session = FindSession(guid) as SimpleServerSession;

            if (session == null)
            {
                return(false);
            }
            sendBuffer.Clear();

            int len = dataBytes.Length;

            byte[] lenBytes = BitConverter.GetBytes(len);
            sendBuffer.Append(lenBytes);
            sendBuffer.Append(dataBytes);

            return(session.SendAsync(sendBuffer.Data, sendBuffer.Offset, sendBuffer.Size));
        }