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

#include <TcpSocketBuilder.h>

Public Member Functions

 FTcpSocketBuilder (const FString &InDescription)
 
FTcpSocketBuilder AsBlocking ()
 
FTcpSocketBuilder AsNonBlocking ()
 
FTcpSocketBuilder AsReusable ()
 
FTcpSocketBuilder AsReusable (bool bInReusable)
 
FTcpSocketBuilder BoundToAddress (const FIPv4Address &Address)
 
FTcpSocketBuilder BoundToEndpoint (const FIPv4Endpoint &Endpoint)
 
FTcpSocketBuilder BoundToPort (uint16 Port)
 
FTcpSocketBuilder Lingering (int32 Timeout)
 
FTcpSocketBuilder Listening (int32 MaxBacklog)
 
FTcpSocketBuilder WithReceiveBufferSize (int32 SizeInBytes)
 
FTcpSocketBuilder WithSendBufferSize (int32 SizeInBytes)
 
 operator FSocket * () const
 
FSocketBuild () const
 

Detailed Description

Implements a fluent builder for TCP sockets.

Constructor & Destructor Documentation

◆ FTcpSocketBuilder()

FTcpSocketBuilder::FTcpSocketBuilder ( const FString &  InDescription)
inline

Creates and initializes a new instance.

Parameters
InDescriptionDebug description for the socket.

Member Function Documentation

◆ AsBlocking()

FTcpSocketBuilder FTcpSocketBuilder::AsBlocking ( )
inline

Sets socket operations to be blocking.

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

◆ AsNonBlocking()

FTcpSocketBuilder FTcpSocketBuilder::AsNonBlocking ( )
inline

Sets socket operations to be non-blocking.

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

◆ AsReusable() [1/2]

FTcpSocketBuilder FTcpSocketBuilder::AsReusable ( )
inline

Makes the bound address reusable by other sockets.

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

◆ AsReusable() [2/2]

FTcpSocketBuilder FTcpSocketBuilder::AsReusable ( bool  bInReusable)
inline

Sets re-usability of the bound address by other sockets.

Parameters
bInReusableWhether to enable or disable re-usability of the bound address.
Returns
This instance (for method chaining).
See also
AsNonBlocking, AsNonBlocking

◆ BoundToAddress()

FTcpSocketBuilder FTcpSocketBuilder::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()

FTcpSocketBuilder FTcpSocketBuilder::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()

FTcpSocketBuilder FTcpSocketBuilder::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, BoundToEndpoint

◆ Build()

FSocket * FTcpSocketBuilder::Build ( ) const
inline

Builds the socket as configured.

Returns
The built socket.

◆ Lingering()

FTcpSocketBuilder FTcpSocketBuilder::Lingering ( int32  Timeout)
inline

Sets how long the socket will linger after closing.

Parameters
TimeoutThe amount of time to linger before closing.
Returns
This instance (for method chaining).

◆ Listening()

FTcpSocketBuilder FTcpSocketBuilder::Listening ( int32  MaxBacklog)
inline

Sets the socket into a listening state for incoming connections.

Parameters
MaxBacklogThe number of connections to queue before refusing them.
Returns
This instance (for method chaining).

◆ operator FSocket *()

FTcpSocketBuilder::operator FSocket * ( ) const
inline

Implicit conversion operator that builds the socket as configured.

Returns
The built socket.

◆ WithReceiveBufferSize()

FTcpSocketBuilder FTcpSocketBuilder::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()

FTcpSocketBuilder FTcpSocketBuilder::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: