Exemplo n.º 1
0
        public GSSession(GSSessionManager manager)
        {
            FSessionManager = manager;

            FPacketHandler = new SessionPacketHandler(this);

            FPacketSpliter = new PacketSpliter();

            FPacketSpliter.OnPacket += FPacketHandler.OnPacket; ;

            FSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            FAcceptEventArg = new SocketAsyncEventArgs();

            FAcceptEventArg.AcceptSocket = FSock;

            FAcceptEventArg.Completed += OnCompleted;

            FAcceptEventArg.UserToken = this;

            FBufferManager = new SockBufferManager();

            FBufferManager.Initialize(10, 10);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Packet Handler Constructor
 /// </summary>
 /// <param name="msgId">Message Identifier</param>
 /// <param name="handler">Packet Handler Delegate</param>
 public PacketHandler(Byte msgId, SessionPacketHandler handler)
 {
     // Initialize the member data
     MessageId = msgId;
     Handler   = handler;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Register a special game packet handler
 /// </summary>
 /// <param name="nMessageId">Message identifier</param>
 /// <param name="handler">Packet Handler</param>
 public void AddSpecialPacketHandler(Byte nMessageId, SessionPacketHandler handler)
 {
     SpecialPacketHandler = new PacketHandler(nMessageId, handler);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Register a game packet handler
 /// </summary>
 /// <param name="nMessageId">Message identifier</param>
 /// <param name="handler">Packet Handler</param>
 public void AddGamePacketHandler(Byte nMessageId, SessionPacketHandler handler)
 {
     GamePacketHandler = new PacketHandler(nMessageId, handler);
 }