ISocketSubsystem::BindNextPort

Bind to next available port.

Choose your operating system:

Windows

macOS

Linux

References

Module

Sockets

Header

/Engine/Source/Runtime/Sockets/Public/SocketSubsystem.h

Include

#include "SocketSubsystem.h"

Source

/Engine/Source/Runtime/Sockets/Private/SocketSubsystem.cpp

Syntax

int32 BindNextPort
(
    FSocket * Socket,
    FInternetAddr & Addr,
    int32 PortCount,
    int32 PortIncrement
)

Remarks

Bind to next available port.

Returns

The bound port number, or 0 on failure

Parameters

Parameter

Description

Socket

The socket that that will bind to the port

Addr

The local address and port that is being bound to (usually the result of GetLocalBindAddr()). This addresses port number will be modified in place

PortCount

How many ports to try

PortIncrement

The amount to increase the port number by on each attempt