UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FUdpSocketBuilder Class Reference

#include <UdpSocketBuilder.h>

Public Member Functions

 FUdpSocketBuilder (const FString &InDescription)
 
FUdpSocketBuilderAsBlocking ()
 
FUdpSocketBuilderAsNonBlocking ()
 
FUdpSocketBuilderAsReusable ()
 
FUdpSocketBuilderBoundToAddress (const FIPv4Address &Address)
 
FUdpSocketBuilderBoundToEndpoint (const FIPv4Endpoint &Endpoint)
 
FUdpSocketBuilderBoundToPort (uint16 Port)
 
FUdpSocketBuilderJoinedToGroup (const FIPv4Address &GroupAddress)
 
FUdpSocketBuilderJoinedToGroup (const FIPv4Address &GroupAddress, const FIPv4Address &InterfaceAddress)
 
FUdpSocketBuilderWithBroadcast ()
 
FUdpSocketBuilderWithMulticastLoopback ()
 
FUdpSocketBuilderWithMulticastTtl (uint8 TimeToLive)
 
FUdpSocketBuilderWithMulticastInterface (const FIPv4Address &InterfaceAddress)
 
FUdpSocketBuilderWithReceiveBufferSize (int32 SizeInBytes)
 
FUdpSocketBuilderWithSendBufferSize (int32 SizeInBytes)
 
 operator FSocket * () const
 
FSocketBuild () const
 

Detailed Description

Implements a fluent builder for UDP sockets.

Constructor & Destructor Documentation

◆ FUdpSocketBuilder()

FUdpSocketBuilder::FUdpSocketBuilder ( const FString &  InDescription)
inline

Creates and initializes a new instance.

Parameters
InDescriptionDebug description for the socket.

Member Function Documentation

◆ AsBlocking()

FUdpSocketBuilder & FUdpSocketBuilder::AsBlocking ( )
inline

Sets socket operations to be blocking.

Returns
This instance (for method chaining).
See also
AsNonBlocking, AsReusable

◆ AsNonBlocking()

FUdpSocketBuilder & FUdpSocketBuilder::AsNonBlocking ( )
inline

Sets socket operations to be non-blocking.

Returns
This instance (for method chaining).
See also
AsBlocking, AsReusable

◆ AsReusable()

FUdpSocketBuilder & FUdpSocketBuilder::AsReusable ( )
inline

Makes the bound address reusable by other sockets.

Returns
This instance (for method chaining).
See also
AsBlocking, AsNonBlocking

◆ BoundToAddress()

FUdpSocketBuilder & FUdpSocketBuilder::BoundToAddress ( const FIPv4Address Address)
inline

Sets the local address to bind the socket to.

Unless specified in a subsequent call to BoundToPort(), a random port number will be assigned by the underlying provider.

Parameters
AddressThe IP address to bind the socket to.
Returns
This instance (for method chaining).
See also
BoundToEndpoint, BoundToPort

◆ BoundToEndpoint()

FUdpSocketBuilder & FUdpSocketBuilder::BoundToEndpoint ( const FIPv4Endpoint Endpoint)
inline

Sets the local endpoint to bind the socket to.

Parameters
EndpointThe IP endpoint to bind the socket to.
Returns
This instance (for method chaining).
See also
BoundToAddress, BoundToPort

◆ BoundToPort()

FUdpSocketBuilder & FUdpSocketBuilder::BoundToPort ( uint16  Port)
inline

Sets the local port to bind the socket to.

Unless specified in a subsequent call to BoundToAddress(), the local address will be determined automatically by the underlying provider.

Parameters
PortThe local port number to bind the socket to.
Returns
This instance (for method chaining).
See also
BoundToAddress

◆ Build()

FSocket * FUdpSocketBuilder::Build ( ) const
inline

Builds the socket as configured.

Returns
The built socket.

◆ JoinedToGroup() [1/2]

FUdpSocketBuilder & FUdpSocketBuilder::JoinedToGroup ( const FIPv4Address GroupAddress)
inline

Joins the socket to the specified multicast group.

Parameters
GroupAddressThe IP address of the multicast group to join.
Returns
This instance (for method chaining).
See also
WithMulticastLoopback, WithMulticastTtl

◆ JoinedToGroup() [2/2]

FUdpSocketBuilder & FUdpSocketBuilder::JoinedToGroup ( const FIPv4Address GroupAddress,
const FIPv4Address InterfaceAddress 
)
inline

Joins the socket to the specified multicast group.

Parameters
GroupAddressThe IP address of the multicast group to join.
InterfaceAddressThe IP address of the interface to join the multicast group on.
Returns
This instance (for method chaining).
See also
WithMulticastLoopback, WithMulticastTtl

◆ operator FSocket *()

FUdpSocketBuilder::operator FSocket * ( ) const
inline

Implicit conversion operator that builds the socket as configured.

Returns
The built socket.

◆ WithBroadcast()

FUdpSocketBuilder & FUdpSocketBuilder::WithBroadcast ( )
inline

Enables broadcasting.

Returns
This instance (for method chaining).

◆ WithMulticastInterface()

FUdpSocketBuilder & FUdpSocketBuilder::WithMulticastInterface ( const FIPv4Address InterfaceAddress)
inline

Sets the multicast outgoing interface.

Parameters
InterfaceAddressThe interface to use to send multicast datagrams.
Returns
This instance (for method chaining).
See also
JoinedToGroup, WithMulticastLoopback

◆ WithMulticastLoopback()

FUdpSocketBuilder & FUdpSocketBuilder::WithMulticastLoopback ( )
inline

Enables multicast loopback.

Parameters
AllowLoopbackWhether to allow multicast loopback.
TimeToLiveThe time to live.
Returns
This instance (for method chaining).
See also
JoinedToGroup, WithMulticastTtl

◆ WithMulticastTtl()

FUdpSocketBuilder & FUdpSocketBuilder::WithMulticastTtl ( uint8  TimeToLive)
inline

Sets the multicast time-to-live.

Parameters
TimeToLiveThe time to live.
Returns
This instance (for method chaining).
See also
JoinedToGroup, WithMulticastLoopback

◆ WithReceiveBufferSize()

FUdpSocketBuilder & FUdpSocketBuilder::WithReceiveBufferSize ( int32  SizeInBytes)
inline

Specifies the desired size of the receive buffer in bytes (0 = default).

The socket creation will not fail if the desired size cannot be set or if the actual size is less than the desired size.

Parameters
SizeInBytesThe size of the buffer.
Returns
This instance (for method chaining).
See also
WithSendBufferSize

◆ WithSendBufferSize()

FUdpSocketBuilder & FUdpSocketBuilder::WithSendBufferSize ( int32  SizeInBytes)
inline

Specifies the desired size of the send buffer in bytes (0 = default).

The socket creation will not fail if the desired size cannot be set or if the actual size is less than the desired size.

Parameters
SizeInBytesThe size of the buffer.
Returns
This instance (for method chaining).
See also
WithReceiveBufferSize

The documentation for this class was generated from the following file: