---
name: "roar_socket_listen"
section: "3"
platform: "linux"
package: "libroar-dev"
version: "1.0~beta12-4"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/roar_socket_listen"
---

# roar\_socket\_listen(3)

Opens a new listen socket

## NAME

roar\_socket\_listen - Opens a new listen socket

## SYNOPSIS

\#include \<roaraudio.h\>

int roar\_socket\_listen(int type, char \* host, int port);

## DESCRIPTION

Opens a new listening socket for network clients to connect to. You may accept new connections via [**accept**(2)](/accept/2.md).

## PARAMETERS

- **type**

  The type of the Socket. See the list below.

- **host**

  The host or path name to listen on. This depends on the type argument. For TCP/IP to listen on any interface use a value of "0.0.0.0".

- **port**

  The port number to listen on. This may be ignored by types not supporting port numbers.

## SOCKET TYPES

- **ROAR\_SOCKET\_TYPE\_UNKNOWN**

  The type will be auto detected. Don't use this if you know the type. Only use this to support user given addresses and enable auto detection.

- **ROAR\_SOCKET\_TYPE\_TCP**

  Use a TCP/IP connection. This is standard mode for networking. **host** is the hostname or IP to listen on and **port** is the port number to use.

- **ROAR\_SOCKET\_TYPE\_INET**

  Same as above but deprecated. Use **ROAR\_SOCKET\_TYPE\_TCP**.

- **ROAR\_SOCKET\_TYPE\_UNIX**

  UNIX Domain Socket. This should be default for local connections. **host** is the filename of the socket.

- **ROAR\_SOCKET\_TYPE\_DECNET**

  DECnet socket.

- **ROAR\_SOCKET\_TYPE\_FORK**

  This is to fork a roard to communicate with. Can't be use to listen on, just to connect to. **host** and **port** is ignored at the moment.

- **ROAR\_SOCKET\_TYPE\_FILE**

  This is used to open a plain file. Can't be use to listen on, just to connect to. **host** is the filename to connect to.

## RETURN VALUE

On success these calls return filehandle.  On error, -1 is returned.

## BUGS

Listening on UDP sockets is not supported at the moment.

## EXAMPLES

FIXME

## SEE ALSO

[**accept**(2)](/accept/2.md), [**libroar**(7)](/libroar/7.md), [**RoarAudio**(7)](/RoarAudio/7.md).
