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

# SSLWrite(_:_:_:_:)

Performs a typical application-level write operation.

```
func SSLWrite(_ context: SSLContext, _ data: UnsafeRawPointer?, _ dataLength: Int, _ processed: UnsafeMutablePointer<Int>) -> OSStatus
```

## Parameters

`context`

An SSL session context reference.

`data`

A pointer to the buffer of data to write.

`dataLength`

The amount, in bytes, of data to write.

`processed`

On return, the length, in bytes, of the data actually written.

## Return Value

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

## Discussion

The [`SSLWrite(_:_:_:_:)`](/documentation/Security/SSLWrite(_:_:_:_:)) function might call the [`SSLWriteFunc`](/documentation/Security/SSLWriteFunc) function that you provide (see [`SSLSetIOFuncs(_:_:_:)`](/documentation/Security/SSLSetIOFuncs(_:_:_:))). Because you may configure the underlying connection to operate in a no-blocking manner, a write operation might return `errSSLWouldBlock`, indicating that less data than requested was actually transferred. In this case, you should repeat the call to [`SSLWrite(_:_:_:_:)`](/documentation/Security/SSLWrite(_:_:_:_:)) until some other result is returned.

---

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)