dotnet / dotnet/dotnet-api-docs

Not a must to close the NetworkStream separately

Open
#1,322 1 comment 1 reaction 0 assignees View on GitHub
area-System.Net dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

Close() internally invokes Dispose() which in turns disposes of the stream, but the doc says "You must close the NetworkStream when you are through sending and receiving data. Closing TcpClient does not release the NetworkStream."

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: fe7d0846-14ff-cce4-2ce5-4df4ba9b5ee5
* Version Independent ID: c1cc7165-fee6-6af3-087b-36a337774399
* Content: [TcpClient.GetStream Method (System.Net.Sockets)](https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.tcpclient.getstream?view=netframework-4.7.2)
* Content Source: [xml/System.Net.Sockets/TcpClient.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Net.Sockets/TcpClient.xml)
* Product: **dotnet-api**
* GitHub Login: @karelz
* Microsoft Alias: **ncldev**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.