---
title: "sec_protocol_metadata_copy_server_name(_:)"
framework: security
role: symbol
role_heading: Function
path: "security/sec_protocol_metadata_copy_server_name(_:)"
---

# sec_protocol_metadata_copy_server_name(_:)

## Declaration

```swift
func sec_protocol_metadata_copy_server_name(_ metadata: sec_protocol_metadata_t) -> UnsafePointer<CChar>?
```

## Parameters

- `metadata`: A sec_protocol_metadata_t instance.

## Return Value

Return Value Returns A NULL-terminated string carrying the server name, or NULL if none was provided.

## Discussion

Discussion Obtain a copy of the server name offered by a client or server during connection establishmet. This is the value commonly carried in the TLS SNI extesion. The caller is expected to free the output string when it is no longer needed.
