TlsContext.clientStream
TlsStream clientStream(TlsTransport transport, string serverName)Creates a client-side TLS stream.
The hostname argument is mandatory by design: it drives both SNI and hostname verification, which binds the peer certificate to the server you intended to reach. Passing null with the default client verification mode (TlsVerifyMode.REQUIRED) MUST fail the handshake; to skip hostname binding you must explicitly lower the verify mode — there is no accidental opt-out.
Parameters
transport | The underlying transport to wrap. |
serverName | The server hostname (for SNI and certificate verification); must not be omitted. |
Returns
A new TLS stream configured as a client.