Skip to content
BSD syscall#133

svc · unix #133

sendto

Sends a datagram or stream segment to a specified address.

Prototype

int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, socklen_t tolen);

Returns: int

Arguments

NameTypeDirDescription
sint-
bufcaddr_t-
lensize_t-
flagsint-
tocaddr_t-
tolensocklen_t-

Version history

XNU tagmacOS#
xnu-1456.1.26macOS 10.6 Snow Leopard133
xnu-1486.2.11133
xnu-1504.15.3133
xnu-1504.3.12133
xnu-1504.7.4133
xnu-1504.9.17133
xnu-1504.9.26133
xnu-1504.9.37133

Notes

For connected sockets the destination argument must be NULL or match the existing peer. UDP sendto is the typical path for unconnected datagram sockets and triggers NECP policy resolution on every call unless the socket has a cached policy ID. Sandboxed apps without the matching network entitlement are rejected at the NECP layer before any packet leaves the kernel.

Detection

NEFilterDataProvider.handleOutboundData fires for each outbound chunk and is the primary tap. nettop -m route -p <pid> gives a coarse counter view without an extension.

Related APIs

sendmsgsendmsg_xwriteconnectnecp_client_action