O'Reilly logo

C# in a Nutshell by Peter Drayton, Ted Neward, Ben Albahari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required