---
name: "rdma_get_src_port"
section: "3"
platform: "linux"
package: "rdma-core"
version: "65.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/rdma_get_src_port"
---

# rdma\_get\_src\_port(3)

Returns the local port number of a bound rdma\_cm\_id.

## NAME

rdma\_get\_src\_port - Returns the local port number of a bound rdma\_cm\_id.

## SYNOPSIS

**#include \<rdma/rdma\_cma.h\>**

**uint16\_t rdma\_get\_src\_port** **(struct rdma\_cm\_id \****id***);**

## ARGUMENTS

- id

  RDMA identifier.

## DESCRIPTION

Returns the local port number for an rdma\_cm\_id that has been bound to a local address.

## RETURN VALUE

Returns the 16-bit port identifier associated with the local endpoint.  If the rdma\_cm\_id is not bound to a port, the returned value is 0.

## SEE ALSO

[rdma\_bind\_addr(3)](/rdma_bind_addr/3.md), [rdma\_resolve\_addr(3)](/rdma_resolve_addr/3.md), [rdma\_get\_dst\_port(3)](/rdma_get_dst_port/3.md), [rdma\_get\_local\_addr(3)](/rdma_get_local_addr/3.md), [rdma\_get\_peer\_addr(3)](/rdma_get_peer_addr/3.md)
