I am now developing a server/client application using TCP protocol for its communication protocol. I have two questions about TcpClient and its underlying NetworkStream. I was goolging, but could not find a clear answer
(1) If I close TcpClient using TcpClient.Close() method, is the underlying NetworkStream will also be closed automatically? For .Net framework 4.5 here (http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.getstream(v=vs.110).aspx) says that "You must close the NetworkStream when you are through sending and receiving data. Closing TcpClient does not release the NetworkStream." However, also for .Net framework 4.5 here ("http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.close(v=vs.110).aspx") says that "Calling this method (TcpClient.Close) will eventually result in the close of the associated Socket and will also close the associated NetworkStream that is used to send and receive data if one was created." I am very confused now.
(2) If I keep my TcpClient open and connected, but I close/dispose the underlying NetworkStream obtained by calling TcpClient.GetStream, can I get such a stream again by calling GetStream method?
Thank you for your inputs!