tcp reader


SUBMITTED BY: Thor2607

DATE: Sept. 29, 2016, 3:12 a.m.

FORMAT: C#

SIZE: 469 Bytes

HITS: 664

  1. private void as_read()
  2. {
  3. BinaryReader br = new BinaryReader(ns);
  4. while (ns.CanRead)
  5. {
  6. while (!ns.DataAvailable) System.Threading.Thread.Sleep(33);
  7. if (!ns.CanRead) return;
  8. int l = br.ReadInt32();
  9. byte[] buffer = new byte[l];
  10. ns.Read(buffer, 0, l);
  11. if (receive != null) receive(buffer);
  12. }
  13. }

comments powered by Disqus