Пример #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);
     }
 }
Пример #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);
Пример #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);
 }