<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/sec_protocol_options_set_tls_server_name(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@sec_protocol_options_set_tls_server_name"
  },
  "title" : "sec_protocol_options_set_tls_server_name(_:_:)"
}
-->

# sec_protocol_options_set_tls_server_name(_:_:)

```
func sec_protocol_options_set_tls_server_name(_ options: sec_protocol_options_t, _ server_name: UnsafePointer<CChar>)
```

## Parameters

`options`

A `sec_protocol_options_t` instance.

`server_name`

A NULL-terminated string carrying the server name.

## Discussion

\abstract Set the server name to be used when verifying the peer’s certificate. This will override
the server name obtained from the endpoint.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)