コード例 #1
0
 /// <summary>
 /// Creates a new <see cref="LiteClientReceiver"/> instance with the given <see cref="ILitePacketProcessor"/>
 /// and a client buffer size.
 /// </summary>
 /// <param name="packetProcessor">Current packet processor used in the client.</param>
 /// <param name="receiveStrategy">The receive strategy type for every received message.</param>
 /// <param name="bufferSize">Buffer size defined in client configuration.</param>
 public LiteClientReceiver(ILitePacketProcessor packetProcessor, ReceiveStrategyType receiveStrategy, int bufferSize)
     : base(packetProcessor, receiveStrategy)
 {
     _buffer                 = new byte[bufferSize];
     _socketEvent            = new SocketAsyncEventArgs();
     _socketEvent.Completed += OnCompleted;
     _socketEvent.SetBuffer(_buffer, 0, _buffer.Length);
 }
コード例 #2
0
 /// <summary>
 /// Creates a new <see cref="LiteReceiver"/> instance with a <see cref="ILitePacketProcessor"/> and a <see cref="ReceiveStrategyType"/>.
 /// </summary>
 /// <param name="packetProcessor">Packet processor to process incoming data and convert it into an exploitable packet stream.</param>
 /// <param name="receiveStrategy">A <see cref="ReceiveStrategyType"/> to use.</param>
 protected LiteReceiver(ILitePacketProcessor packetProcessor, ReceiveStrategyType receiveStrategy)
 {
     _packetProcessor = packetProcessor;
     ReceiveStrategy  = receiveStrategy;
     _packetParser    = new LitePacketParser(_packetProcessor);
 }
コード例 #3
0
 /// <summary>
 /// Creates a new <see cref="LiteServerReceiver"/> instance with the given <see cref="ILitePacketProcessor"/>
 /// and a client buffer size.
 /// </summary>
 /// <param name="packetProcessor">Current packet processor used in the server.</param>
 /// <param name="receiveStrategy">The receive strategy type for every received message.</param>
 /// <param name="clientBufferSize">Client buffer size defined in server configuration.</param>
 public LiteServerReceiver(ILitePacketProcessor packetProcessor, ReceiveStrategyType receiveStrategy, int clientBufferSize)
     : base(packetProcessor, receiveStrategy)
 {
     _readPool         = ObjectPool.Create <SocketAsyncEventArgs>();
     _clientBufferSize = clientBufferSize;
 }