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

# SSLSetDatagramHelloCookie(_:_:_:)

Sets the cookie value used in the Datagram Transport Layer Security (DTLS) hello message.

## Declaration

```swift
func SSLSetDatagramHelloCookie(_ dtlsContext: SSLContext, _ cookie: UnsafeRawPointer?, _ cookieLen: Int) -> OSStatus
```

## Parameters

- `dtlsContext`: The SSL context associated with the connection.
- `cookie`: The cookie value.
- `cookieLen`: The length of the cookie (up to 32 bytes).

## Return Value

Return Value A result code. See Secure Transport Result Codes.

## Discussion

Discussion This function should be called only on the server side, and is optional. The default cookie is a zero-length cookie.
