Exemplo n.º 1
0
 /// <summary>
 /// Pack
 /// </summary>
 /// <param name="source"></param>
 /// <param name="onPacked"></param>
 public void Pack(byte[] source, Action <byte[]> onPacked)
 {
     using (BlockBuffer <byte> buffer = new BlockBuffer <byte>(source))
     {
         Pack(buffer, onPacked);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Sub class achive this methond
 /// </summary>
 /// <param name="writer"></param>
 /// <param name="onPacked"></param>
 protected abstract void Pack(BlockBuffer <byte> bytes, Action <byte[]> onPacked);
Exemplo n.º 3
0
 /// <summary>
 /// The default buffer is 1<<16, if small will automatically add buffer block
 /// </summary>
 /// <param name="bufferSize"></param>
 public TcpSocket(int bufferSize = 1 << 16)
 {
     SendBuffer    = new BlockBuffer <byte>(bufferSize);
     ReceiveBuffer = new BlockBuffer <byte>(bufferSize);
 }