Name

NetworkStream

Synopsis

This class creates a basic network stream from an underlying socket. It allows for simple data access to the stream and supports permissions settings.

public class NetworkStream : System.IO.Stream {
// Public Constructors
   public NetworkStream(Socket socket);
   public NetworkStream(Socket socket, bool ownsSocket);
   public NetworkStream(Socket socket, System.IO.FileAccess access);
   public NetworkStream(Socket socket, System.IO.FileAccess access, bool ownsSocket);
// Public Instance Properties
   public override bool CanRead{get; }   
// overrides System.IO.Stream
   public override bool CanSeek{get; }   
// overrides System.IO.Stream
   public override bool CanWrite{get; }  
// overrides System.IO.Stream
   public virtual bool DataAvailable{get; }
   public override long Length{get; }    
// overrides System.IO.Stream
   public override long Position{set; get; }          
// overrides System.IO.Stream
                  // Protected Instance Properties
   protected bool Readable{set; get; }
   protected Socket Socket{get; }
   protected bool Writeable{set; get; }
// Public Instance Methods
   public override IAsyncResult BeginRead(byte[ ] buffer, int offset, int size,
       AsyncCallback callback, object state)
// overrides System.IO.Stream
   public override IAsyncResult BeginWrite(byte[ ] buffer, int offset, int size,
       AsyncCallback callback, object state)
// overrides System.IO.Stream
   public override void Close( );         
// overrides System.IO.Stream
   public override int EndRead(IAsyncResult asyncResult);  
// overrides System.IO.Stream public ...

Get C# in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.