listen

The `listen` directive in the NGINX SRT module specifies the address and port for the SRT server to accept incoming connections.

Syntaxlisten address:port [backlog=number] [bind] [ipv6only=on|off] [reuseport];
Defaultnone
Context
Arguments1+

Description

The listen directive in the NGINX SRT module allows users to define the address and port on which the SRT server will listen for incoming SRT connections. It is important to note that the directive requires at least one argument, where the address can be given in a standard format (e.g., 0.0.0.0:4321 for IPv4), and it can also include several optional parameters such as backlog, bind, ipv6only, and reuseport for enhanced control over how connections are managed.

When specifying the listen directive, the first argument is the address:port combination, which tells NGINX which interface and port to bind to. The optional backlog parameter can define the size of the queue of pending connections, which is useful in handling burst traffic. The bind option indicates whether to bind specifically to the provided address, while ipv6only determines if IPv6 addresses are to be accepted when the socket is bound to both IPv4 and IPv6 addresses. Lastly, reuseport allows multiple sockets to listen on the same IP and port, distributing incoming connections to different NGINX worker processes, which can improve performance under high loads.

This directive operates in a server context under the SRT configuration, making it vital for setting up a listening point for both incoming SRT and TCP traffic, facilitating the bidirectional data transfer capabilities of the module.

Config Example

srt {
    server {
        listen 4321;
        proxy_pass tcp://127.0.0.1:5678;
    }
}

Ensure the port specified is not in use by another service to avoid binding errors.

Be mindful of the address format; using an incorrect format can lead to startup errors.

If reuseport is enabled, ensure that NGINX is compiled with the appropriate support.

Not specifying the bind option when using multiple IP addresses can lead to unexpected binding behavior.

← Back to all directives