Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[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
- socket
Type: System.Net.Sockets. . :: . .Socket
The Socket that the NetworkStream will use to send and receive data.
- ownsSocket
Type: System. . :: . .Boolean
Set to true to indicate that the NetworkStream will take ownership of the Socket; otherwise, false.
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.