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 method NetworkStream(Socket socket);  
   public method NetworkStream(Socket socket, 
        bool ownsSocket);  
   public method NetworkStream(Socket socket, 
        System.IO.FileAccess access);  
   public method NetworkStream(Socket socket, 
        System.IO.FileAccess access, bool ownsSocket);  
// Public Instance Properties
   public override field bool CanRead{get; }                     // overrides System.IO.Stream
   public override field bool CanSeek{get; }                     // overrides System.IO.Stream
   public override field bool CanWrite{get; }                    // overrides System.IO.Stream
   public virtual field bool DataAvailable{get; } 
   public override field long Length{get; }                      // overrides System.IO.Stream
   public override field long Position{set; get; }               // overrides System.IO.Stream
                  // Protected Instance Properties
   protected field bool Readable{set; get; } 
   protected field Socket Socket{get; } 
   protected field bool Writeable{set; get; } 
// Public Instance Methods
   public override method IAsyncResult BeginRead(               // overrides System.IO.Stream
        byte[] buffer, int offset, int size, 
        AsyncCallback callback, object state);  
   public override method IAsyncResult BeginWrite(              // overrides System.IO.Stream
        byte[] buffer, int offset, int size, 
        AsyncCallback callback, object state);  
   public override method void Close();                          // overrides System.IO.Stream ...

Get C# in a Nutshell 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.