Does one need to close both NetworkStream and TcpClient, or just TcpClient?

后端 未结 4 1792
暖寄归人
暖寄归人 2021-02-13 00:13

I\'m reading the documentation on TcpClient.Close() and noticed this:

Calling this method will eventually result in the close of the associated Socket and

4条回答
  •  太阳男子
    2021-02-13 01:20

    Responding to this question since no one else did so that I may accept an answer.

    According to Hans, calling NetworkStream.Close() is unnecessary because TcpClient.Close() closes its underlying NetworkStream.

提交回复
热议问题