public static async Task <BufferReader> ReceiveBufferReaderAsync(UdpClient client, int headerSize) { var response = await client.ReceiveAsync(); var reader = new BufferReader(response.Buffer); reader.Skip(headerSize); return(reader); }
public async Task <string> ReadStringAsync() { var byteEnumerables = new List <IEnumerable <byte> >(); while (!_reader.IsStringTerminated()) { byteEnumerables.Add(_reader.ReadBytes(_reader.Remaining)); _reader = await _sequelRequestAsyncFunc(); } byteEnumerables.Add(_reader.ReadUntil(x => x != 0x00)); _reader.Skip(1); return(Encoding.UTF8.GetString(byteEnumerables.SelectMany(x => x).ToArray())); }