---
title: "CFSocketCopyPeerAddress(_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfsocketcopypeeraddress(_:)"
---

# CFSocketCopyPeerAddress(_:)

Returns the remote address to which a CFSocket object is connected.

## Declaration

```swift
func CFSocketCopyPeerAddress(_ s: CFSocket!) -> CFData!
```

## Parameters

- `s`: The CFSocket object to examine.

## Return Value

Return Value The remote address, stored as a struct sockaddr appropriate for the protocol family (struct sockaddr_in or struct sockaddr_in6, for example) in a CFData object, to which s is connected. Ownership follows the The Create Rule.

## See Also

### Configuring Sockets

- [CFSocketCopyAddress(_:)](corefoundation/cfsocketcopyaddress(_:).md)
- [CFSocketDisableCallBacks(_:_:)](corefoundation/cfsocketdisablecallbacks(_:_:).md)
- [CFSocketEnableCallBacks(_:_:)](corefoundation/cfsocketenablecallbacks(_:_:).md)
- [CFSocketGetContext(_:_:)](corefoundation/cfsocketgetcontext(_:_:).md)
- [CFSocketGetNative(_:)](corefoundation/cfsocketgetnative(_:).md)
- [CFSocketGetSocketFlags(_:)](corefoundation/cfsocketgetsocketflags(_:).md)
- [CFSocketSetAddress(_:_:)](corefoundation/cfsocketsetaddress(_:_:).md)
- [CFSocketSetSocketFlags(_:_:)](corefoundation/cfsocketsetsocketflags(_:_:).md)
