tags:

views:

338

answers:

1

Hello,

.NET allows two very similar ways to "read" from the network (assuming TCP connection):

1. TcpClient.GetStream().Read() 
2. TcpClient.Client.Receive()

By looking at NetworkStream source code - it seems that it's an extra wrapper over the underlying socket, which eventually calls Socket methods.

Question: what's the benefit of using "indirect" NetworkStream variation (#1), instead of using direct wrapper provided by Socket implementation?

Thank you, Boris.

A: 

Nothing, really. It's just that sometimes it's more convenient to use a Stream.

Gonzalo