private void Read() { while (true) { _packet = _peer.Receive(); while (_packet != null) { _peer.DeallocatePacket(_packet); _packet = _peer.Receive(); } Thread.Sleep(10); } }
public override int Read(byte[] buf, int off, int len) { if (currentPacket.IsDone) { currentPacket.Packet = peer.Receive(); if (currentPacket.IsDone) // no more packets { return(0); } } return(currentPacket.Read(buf, off, len)); }