<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.6.0"
  ],
  "documentType" : "symbol",
  "framework" : "IOBluetooth",
  "identifier" : "/documentation/IOBluetooth/OBEXSessionGetAvailableCommandResponsePayloadLength",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "IOBluetooth"
    ],
    "preciseIdentifier" : "c:@F@OBEXSessionGetAvailableCommandResponsePayloadLength"
  },
  "title" : "OBEXSessionGetAvailableCommandResponsePayloadLength"
}
-->

# OBEXSessionGetAvailableCommandResponsePayloadLength

Gets space available for your data for a particular command response you are trying to send.

```
OBEXError OBEXSessionGetAvailableCommandResponsePayloadLength(OBEXSessionRef inSessionRef, OBEXOpCode inOpCode, OBEXMaxPacketLength *outLength);
```

## Parameters

`inSessionRef`

A valid session reference.

`inOpCode`

A command opcode that you are responding to. For example, if you receiving a Put command, and want to send back a “bad request” response, you should still pass in the Put command opcode for that response.

`outLength`

Space available for your header data in the payload area for a particular command.

## Return Value

An error code value. 0 if successful.

## Discussion

The OBEXSession takes care of packaging OBEX opcodes and other information into the proper packet format, allowing you to focus on sending the proper OBEX headers in your commands and command responses. This formatting and datas requires a small bit of information that varies depending on what command or response you are sending. Thus, you should call this function to find out how much space will be left for your headers before you send the command, allowing you to properly chop up your headers before sending them. This will guarantee that (a) you use up all the available space in a packet and (b) that you do not get an error trying to send too much information at once.

*** DEPRECATED IN BLUETOOTH 2.2 (OS X v10.6) *** You should transition your code to Objective-C equivalents. *** This API may be removed any time in the future.

---

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)