<!--
{
  "availability" : [
    "iOS: 9.0.0 - 13.0.0",
    "iPadOS: 9.0.0 - 13.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.11.0 - 10.15.0"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/SSLCopyRequestedPeerNameLength(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@SSLCopyRequestedPeerNameLength"
  },
  "title" : "SSLCopyRequestedPeerNameLength(_:_:)"
}
-->

# SSLCopyRequestedPeerNameLength(_:_:)

Obtains the hostname specified by the client in the ServerName extension (SNI). Server only.

```
func SSLCopyRequestedPeerNameLength(_ ctx: SSLContext, _ peerNameLen: UnsafeMutablePointer<Int>) -> OSStatus
```

## Parameters

`ctx`

An SSL session context reference.

`peerNameLen`

The length of the peer name, as retrieved by calling the [`SSLCopyRequestedPeerName(_:_:_:)`](/documentation/Security/SSLCopyRequestedPeerName(_:_:_:)) function.

## Return Value

A result code. See [Secure Transport Result Codes](/documentation/Security/secure-transport-result-codes).

## Discussion

---

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)