I'm confused as to what is "best" to use when dealing with sockets. The Socket object provides Send/Receive methods (and async equivalents), but also allows a NetworkStream to be created. The only way I've had any joy using Socket.Send is by wrapping the call in a block such as:
using (Stream stream = new NetworkStream(socket)) {
socket.Send(...);
stream.Flush();
}
When using SslStream, if you send a message on the underlying socket, will it be sent over SSL? Should I just use Stream.Write(...) rather than the socket methods?
Thanks.