/// <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); } }
/// <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);
/// <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); }