NAME(3) Library Functions Manual NAME(3)

# [NAME](#NAME)

`krb5_getportbyname` — get port number by name

# [LIBRARY](#LIBRARY)

Kerberos 5 Library (libkrb5, -lkrb5)

# [SYNOPSIS](#SYNOPSIS)

`#include <krb5.h>`

`int`  
`krb5_getportbyname`(`krb5_context context`, `const char *service`, `const char *proto`, `int default_port`);

# [DESCRIPTION](#DESCRIPTION)

[`krb5_getportbyname`](#krb5_getportbyname)() gets the port number for `service /` `proto` pair from the global service table for and returns it in network order. If it isn't found in the global table, the `default_port` (given in host order) is returned.

# [EXAMPLE](#EXAMPLE)

```
int port = krb5_getportbyname(context, "kerberos", "tcp", 88);
```

# [SEE ALSO](#SEE_ALSO)

[krb5(3)](/man/os/heimdal/krb5.3)

August 15, 2004 HEIMDAL

---

Document: krb5_getportbyname(3) from heimdal 7.8.0-r54 (Chainguard OS)
Source: https://github.com/heimdal/heimdal
