Networking System [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.x.x 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.IO.Stream

The class provides methods for sending and receiving data over sockets in blocking mode. For more information about blocking versus nonblocking s, see Using an Asynchronous Client Socket. You can use the class for both synchronous and asynchronous data transfer. For more information about synchronous and asynchronous communication, see Sockets.

To create a , you must provide a connected . You can also specify what permission the has over the provided . By default, closing the does not close the provided . If you want the to have permission to close the provided , you must specify true for the value of the parameter.

Use the and methods for simple single thread synchronous blocking I/O. If you want to process your I/O using separate threads, consider using the and methods, or the and methods for communication.

The does not support random access to the network data stream. The value of the property, which indicates whether the stream supports seeking, is always false; reading the property, reading the property, or calling the method will throw a .

Read and write operations can be performed simultaneously on an instance of the class without the need for synchronization. As long as there is one unique thread for the write operations and one unique thread for the read operations, there will be no cross-interference between read and write threads and no synchronization is required.

Provides the underlying stream of data for network access.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  is .

  The property of is .

  -or-

  The property of is .

  -or-

  The property of is not .

  The is created with read/write access to the specified . The does not own the underlying , so calling the method does not close the .

  Creates a new instance of the class for the specified .

  The that the will use to send and receive data.
  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  is .

  The property of is .

  -or-

  The property of is .

  -or-

  The property of is not .

  The is created with read/write access to the specified . If the value of parameter is true, the takes ownership of the underlying , and calling the method also closes the underlying .

  Initializes a new instance of the class for the specified with the specified ownership.

  The that the will use to send and receive data.
  Set to true to indicate that the will take ownership of the ; otherwise, false.
  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  is .

  The property of is .

  -or-

  The property of is .

  -or-

  The property of is not .

  The is created with the specified access to the specified . With this constructor, the does not own the underlying , so calling the method does not close the underlying .

  The parameter sets the and properties of the . If you specify , then the allows calls to the method. If you specify , then the allows calls to the method. If you specify , both method calls are allowed.

  Creates a new instance of the class for the specified with the specified access rights.

  The that the will use to send and receive data.
  A bitwise combination of the values that specify the type of access given to the over the provided .
  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  is .

  The property of is .

  -or-

  The property of is .

  -or-

  The property of is not .

  The is created with read/write access to the specified . If the value of the parameter is true, the takes ownership of the underlying , and calling the method also closes the underlying .

  The parameter sets the and properties of the . If you specify , then the allows calls to the method. If you specify , then the allows calls to the method. If you specify , both method calls are allowed.

  Creates a new instance of the class for the specified with the specified access rights and the specified ownership.

  The that the will use to send and receive data.
  A bitwise combination of the values that specifies the type of access given to the over the provided .
  Set to true to indicate that the will take ownership of the ; otherwise, false.
  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` `` `` `` is .

  < 0.

  -or-

  > .Length.

  -or-

  < 0.

  -or-

  > .Length - .

  An error occurred while accessing the underlying socket.

  Any exception thrown by the method is caught and rethrown as an with the original exception stored in the property.

  The current instance has been disposed.

  For an outline of an asynchronous operation, see the method. For the complete example, see the class overview.

  The method starts asynchronously reading data from the incoming network buffers. Calling the method gives you the ability to receive data within a separate execution thread.

  You must create a callback method that implements the delegate and pass its name to the method. At the very minimum, your parameter must contain the . Because you will want to obtain the received data within your callback method, you should create a small class or structure to hold a read buffer and any other useful information. Pass the structure or class instance to the method through the parameter.

  Your callback method should call the method. When your application calls , the system will wait until data is received or an error occurs, and then the system will use a separate thread to execute the specified callback method, and blocks on until the provided reads data or throws an exception. If you want the original thread to block after you call the method, use the method. Call in the callback method when you want the original thread to continue executing. For additional information about writing callback methods, see Callback Sample.

  The method reads as much data as is available, up to the number of bytes specified by the parameter.

  If you receive an , check the property to determine if it was caused by a . If so, use the property to obtain the specific error code, and refer to the Windows Sockets version 2 API error code documentation in MSDN for a detailed description of the error.

  Read and write operations can be performed simultaneously on an instance of the class without the need for synchronization. As long as there is one unique thread for the write operations and one unique thread for the read operations, there will be no cross-interference between read and write threads and no synchronization is required.

  Begins an asynchronous read from the .

  An that represents the asynchronous call.

  An array of type that is the location in memory to store data read from the . The location in to begin storing the data. The number of bytes to read from the . The delegate that is executed when completes. An object that contains any additional user-defined data. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.IAsyncResult `` `` `` `` `` is .

  < 0.

  -or-

  > .Length.

  -or-

  < 0.

  -or-

  > .Length - .

  An error occurred while accessing the underlying socket.

  Any exception thrown by the method is caught and rethrown as an with the original exception stored in the property.

  The current instance has been disposed.

  For an outline of an asynchronous operation, see the method. For the complete example, see the class overview.

  The method starts an asynchronous send operation to the remote host. Calling the method gives you the ability to send data within a separate execution thread.

  You must create a callback method that implements the delegate and pass its name to the method. At the very minimum, your parameter must contain the . If your callback needs more information, you can create a small class or structure to hold the and the other required information. Pass the structure or class instance to the method through the parameter.

  Your callback method should implement the method. When your application calls , the system uses a separate thread to execute the specified callback method, and blocks on until the sends the number of bytes requested or throws an exception. If you want the original thread to block after you call the method, use the method. Call in the callback method when you want the original thread to continue executing. For additional information about writing callback methods, see Callback Sample.

  If you receive an , check the property to determine if it was caused by a . If so, use the property to obtain the specific error code, and refer to the Windows Sockets version 2 API error code documentation in MSDN for a detailed description of the error.

  Read and write operations can be performed simultaneously on an instance of the class without the need for synchronization. As long as there is one unique thread for the write operations and one unique thread for the read operations, there will be no cross-interference between read and write threads and no synchronization is required.

  Begins an asynchronous write to a stream.

  An that represents the asynchronous call.

  An array of type that contains the data to write to the . The location in to begin sending the data. The number of bytes to write to the . The delegate that is executed when completes. An object that contains any additional user-defined data. 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  indicates that the current stream supports reading; . indicates that the current stream does not support reading.

  If is true, allows calls to the method. Provide the appropriate enumerated value in the constructor to set the readability and writability of the . The property is set when the is initialized.

  Gets a value that indicates whether the supports reading.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  .

  This property is read-only.

  This property overrides .

  Gets a value that indicates whether the stream supports seeking. This property is not currently supported.This property always returns false.

  0
- Property
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  This property is present because it is inherited from .

  Indicates whether timeout properties are usable for .

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  indicates that the current stream supports writing; indicates that the current stream does not support writing.

  If is true, allows calls to the method. Provide the appropriate enumerated value in the constructor to set the readability and writability of the . The property is set when the is initialized.

  Gets a value that indicates whether the supports writing.

  0
- Method
  System.Void

  The method frees both unmanaged and managed resources associated with the . If the owns the underlying , it is closed as well.

  If a was associated with a , the method will close the TCP connection, but not dispose of the associated .

  Closes the .

  0
  1.0.5000.0
- Method
  2.0.0.0
  4.0.0.0
  System.Void ``

  The method frees both unmanaged and managed resources associated with the . If the owns the underlying , it is closed as well.

  If a was associated with a , the method will close the TCP connection, but not dispose of the associated .

  Closes the after waiting the specified time to allow data to be sent.

  A 32-bit signed integer that specifies the number of milliseconds to wait to send any remaining data before closing.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  indicates that data is available to be read; indicates that there is no data available to be read.

  The current instance has been disposed.

  Use the property to determine if data is ready to be read. If is true, a call to returns immediately. If the remote host shuts down or closes the connection, may throw a .

  Gets a value that indicates whether data is available on the to be read.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void ``

  This method is called by the public Dispose method and the method. Dispose invokes the protected Dispose(Boolean) method with the parameter set to true. invokes Dispose with set to false.

  When the parameter is true, this method releases all resources held by any managed objects that this references. This method invokes the Dispose method of each referenced object.

  Releases the unmanaged resources used by the and optionally releases the managed resources.

  true to release both managed and unmanaged resources; false to release only unmanaged resources. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` A object that holds the state information for the asynchronous operation. is . An error occurred while accessing the underlying socket.

  This method catches all exceptions thrown by the method.

  The current instance has been disposed.

  For an outline of an asynchronous operation, see the method. For the complete example, see the class overview.

  The method completes the asynchronous read operation started in the method.

  Before calling , you need to create a callback method that implements the delegate. This callback method executes in a separate thread and is called by the system after returns. The callback method must accept the returned from the method as a parameter.

  Within the callback method, call the property of the to obtain the state object passed to the method. Extract the receiving from this state object. After obtaining the , call the method to successfully complete the read operation and return the number of bytes read.

  The method blocks until data is available. The method reads as much data as is available up to the number of bytes specified in the parameter of the method. If the remote host shuts down the connection and all available data has been received, the method completes immediately and returns zero bytes.

  To obtain the received data, call the property of the , and extract the buffer contained in the resulting state object.

  If you receive an , check the property to determine if it was caused by a . If so, use the property to obtain the specific error code, and refer to the Windows Sockets version 2 API error code documentation in MSDN for a detailed description of the error.

  Handles the end of an asynchronous read.

  The number of bytes read from the .

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` A object that holds the state information for the asynchronous operation. is . An error occurred while accessing the underlying socket.

  This method catches all exceptions thrown by the method.

  The current instance has been disposed.

  For an outline of an asynchronous operation, see the method. For the complete example, see the class overview.

  completes the asynchronous send operation started in .

  Before calling , you need to create a callback method that implements the delegate. This callback method executes in a separate thread and is called by the system after returns. The callback method must accept the returned from the method as a parameter.

  Within the callback method, call the property of the parameter to obtain the . After obtaining the , you can call the method to successfully complete the send operation and return the number of bytes sent.

  The method blocks until the requested number of bytes are sent.

  If you receive an , check the property to determine if it was caused by a . If so, use the property to obtain the specific error code, and refer to the Windows Sockets version 2 API error code documentation in MSDN for a detailed description of the error.

  Handles the end of an asynchronous write.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  This method overrides . Application code should not call this method; an object's method is automatically invoked during garbage collection, unless finalization by the garbage collector has been disabled by a call to the method.

  For more information about using the Finalize method, see Finalize Methods and Destructors, Cleaning Up Unmanaged Resources, and Overriding the Finalize Method.

  Releases all resources used by the .

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  The method implements the method; however, because is not buffered, it has no affect on network streams. Calling the method does not throw an exception.

  Flushes data from the stream. This method is reserved for future use.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int64 To be added.

  The base class implements this property to return the length of the data available on the stream. This functionality is not supported in the class.

  This property overrides .

  Any attempt to access this property.

  Gets the length of the data available on the stream. This property is not currently supported and always throws a .

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int64 To be added.

  The base class implements this property to return or set the current position in the stream. This functionality is not supported in the class.

  This property overrides .

  Any attempt to access this property.

  Gets or sets the current position in the stream. This property is not currently supported and always throws a .

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` is .

  < 0.

  -or-

  > .Length.

  -or-

  < 0.

  -or-

  > .Length - .

  An error occurred while accessing the underlying socket.

  This method catches all exceptions thrown by the method.

  The current instance has been disposed.

  This method reads data into the parameter and returns the number of bytes successfully read. If no data is available for reading, the method returns 0. The operation reads as much data as is available, up to the number of bytes specified by the parameter. If the remote host shuts down the connection, and all available data has been received, the method completes immediately and return zero bytes.

  Check to see if the is readable by calling the property. If you attempt to read from a that is not readable, you will get an .

  If you receive an , check the property to determine if it was caused by a . If so, use the property to obtain the specific error code, and refer to the Windows Sockets version 2 API error code documentation in MSDN for a detailed description of the error.

  Reads data from the .

  The number of bytes read from the .

  An array of type that is the location in memory to store data read from the . The location in to begin storing the data to. The number of bytes to read from the . 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  You must derive from the class to use the property. If is true, allows calls to the method. You can also determine whether a is readable by checking the publicly accessible property.

  The property is set when the is initialized.

  Gets or sets a value that indicates whether the can be read.

- Property
  2.0.0.0
  4.0.0.0
  System.Int32 To be added.

  If the read operation does not complete within the time specified by this property, the read operation throws an .

  This property affects only synchronous reads performed by calling the method. This property does not affect asynchronous reads performed by calling the method.

  Gets or sets the amount of time that a read operation blocks waiting for data.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int64 `` ``

  The base class uses this method to set the current position in the stream. This functionality is not supported in the class.

  This method overrides .

  Any call to this method.

  Sets the current position of the stream to the given value. This method is not currently supported and always throws a .

  The position in the stream.

  This parameter is not used. This parameter is not used. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void ``

  The base class uses this method to set the length of the data available on the stream. This functionality is not supported in the class.

  This method overrides .

  Any call to this method.

  Sets the length of the stream. This method always throws a .

  This parameter is not used. 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Net.Sockets.Socket To be added.

  Classes deriving from can use this property to get the underlying . Use the underlying returned from the property if you require access beyond that which provides.

  This property is accessible only through this class or a derived class.

  Gets the underlying .

- Method
  1.0.5000.0
  2.0.0.0
  System.Void

  Call when you are finished using the . The method leaves the in an unusable state. After calling , you must release all references to the so the garbage collector can reclaim the memory that the was occupying. For more information about using the Dispose method, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method.

  Always call before you release your last reference to the . Otherwise, the resources it is using are not freed until the garbage collector calls the object's Finalize method.

  Releases all resources used by the .

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` is .

  < 0.

  -or-

  > .Length.

  -or-

  < 0.

  -or-

  > .Length - .

  An error occurred while accessing the underlying socket.

  This method catches all exceptions thrown by the method.

  The current instance has been disposed.

  The method starts at the specified and sends bytes from the contents of to the network. The method blocks until the requested number of bytes is sent or a is thrown. If you receive a , use the property to obtain the specific error code, and refer to the Windows Sockets version 2 API error code documentation in MSDN for a detailed description of the error.

  Check to see if the is writable by accessing the property. If you attempt to write to a that is not writable, you will get an . If you receive an , check the property to determine if it was caused by a .

  Writes data to the .

  An array of type that contains the data to write to the . The location in from which to start writing data. The number of bytes to write to the . 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  You must derive from the class to use the property. If is true, allows calls to the method. You can also determine whether a is writable by checking the publicly accessible property.

  The property is set when the is initialized.

  Gets a value that indicates whether the is writable.

- Property
  2.0.0.0
  4.0.0.0
  System.Int32 To be added.

  If the write operation does not complete within the time specified by this property, the write operation throws a .

  This property affects only synchronous write operations performed by calling the method. This property does not affect asynchronous writes performed by calling the method.

  Gets or sets the amount of time that a write operation blocks waiting for data.

0