---
name: "socket_getifidx"
section: "3"
platform: "linux"
package: "libowfat-dev"
version: "0.32-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/socket_getifidx"
---

# socket\_getifidx(3)

get interface number

## NAME

socket\_getifidx - get interface number

## SYNTAX

**#include \<libowfat/socket.h\>**

int **socket\_getifidx**(const char\* *ifname*);

## DESCRIPTION

socket\_getifidx returns the interface number for a symbolic network interface name (like "eth0" on Linux, for example).

The interface number can be used as scope\_id for IPv6 communications on link-local addresses.

If something goes wrong, socket\_getifidx returns -1, setting errno appropriately.

## SEE ALSO

[socket\_getifname(3)](/socket_getifname/3.md), [socket\_connect6(3)](/socket_connect6/3.md)
