Type Summary





Type Summary


public class NetworkStream : Stream, IDisposable

    {

    // Constructors

       public NetworkStream(Socket socket);

       public NetworkStream(Socket socket, bool ownsSocket);

       public NetworkStream(Socket socket, FileAccess access);

       public NetworkStream(Socket socket, FileAccess access, 

              bool ownsSocket);



    // Properties

       public override bool CanRead { get; }

       public override bool CanSeek { get; }

       public override bool CanWrite { get; }

       public virtual bool DataAvailable { get; }

       public override long Length { get; }

       public override long Position { get; set; }

 MS CF protected bool Readable { get; set; }

 MS CF protected Socket Socket { get; }

 MS CF protected bool Writeable { get; set; }



    // Methods

       public override IAsyncResult BeginRead(byte[] buffer, int offset, 

                                    int size, AsyncCallback callback, 

                                    object state);

       public override IAsyncResult BeginWrite(byte[] buffer, int offset, 

                                    int size, AsyncCallback callback, 

                                    object state);

       public override void Close();

       protected virtual void Dispose(bool disposing);

       public override int EndRead(IAsyncResult asyncResult);

       public override void EndWrite(IAsyncResult asyncResult);

       ~NetworkStream();

       public override void Flush();

       public override int Read(byte[] buffer, int offset, int size);

       public override long Seek(long offset, SeekOrigin origin);

       public override void SetLength(long value);

       public override void Write(byte[] buffer, int offset, int size);

    // Explicit Interface Members

    MS void IDisposable.Dispose();

    }


LO Many network sources provide data in a way that makes it impossible to seek directly against the network stream. Classes that require streams to be seekable can be problematic in these cases and should be avoided whenever possible. In cases where the stream must be seekable, you may be forced to buffer the data into a MemoryStream and pass that in to the class once the data has all been read from the network.



     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows