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

后端 未结 4 1342
执笔经年
执笔经年 2021-02-13 00:16

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:06

    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.

提交回复
热议问题