This documentation is archived and is not being maintained.

NetworkStream.Close Method

Closes the NetworkStream.

[Visual Basic]
Overrides Public Sub Close()
[C#]
public override void Close();
[C++]
public: void Close();
[JScript]
public override function Close();

Remarks

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

Example

[Visual Basic, C#, C++] The following example closes the NetworkStream.

[Visual Basic] 
' Close the NetworkStream
myNetworkStream.Close()
      

[C#] 

// Close the NetworkStream
myNetworkStream.Close();


[C++] 

        // Close the NetworkStream
        myNetworkStream->Close();

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

NetworkStream Class | NetworkStream Members | System.Net.Sockets Namespace

Show: