Share via


NetworkStream Constructor (Socket, Boolean)

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

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

Namespace:  System.Net.Sockets
Assembly:  System (in System.dll)

Syntax

'Declaration
Public Sub New ( _
    socket As Socket, _
    ownsSocket As Boolean _
)
public NetworkStream(
    Socket socket,
    bool ownsSocket
)
public:
NetworkStream(
    Socket^ socket, 
    bool ownsSocket
)
new : 
        socket:Socket * 
        ownsSocket:bool -> NetworkStream
public function NetworkStream(
    socket : Socket, 
    ownsSocket : boolean
)

Parameters

Remarks

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

.NET Framework Security

See Also

Reference

NetworkStream Class

NetworkStream Overload

System.Net.Sockets Namespace