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

#include <UdpSocketSender.h>

+ Inheritance diagram for FUdpSocketSender:

Public Member Functions

 FUdpSocketSender (FSocket *InSocket, const TCHAR *ThreadDescription)
 
virtual ~FUdpSocketSender ()
 
uint32 GetSendRate () const
 
uint32 GetThroughput () const
 
bool Send (const TSharedRef< TArray< uint8 >, ESPMode::ThreadSafe > &Data, const FIPv4Endpoint &Recipient)
 
void SetSendRate (uint32 Rate)
 
void SetWaitTime (const FTimespan &Timespan)
 
virtual FSingleThreadRunnableGetSingleThreadInterface () override
 
virtual bool Init () override
 
virtual uint32 Run () override
 
virtual void Stop () override
 
virtual void Exit () override
 
- Public Member Functions inherited from FRunnable
virtual ~FRunnable ()
 

Protected Member Functions

bool Update (const FTimespan &SocketWaitTime)
 
virtual void Tick () override
 

Detailed Description

Asynchronously sends data to an UDP socket.

Constructor & Destructor Documentation

◆ FUdpSocketSender()

FUdpSocketSender::FUdpSocketSender ( FSocket InSocket,
const TCHAR ThreadDescription 
)
inline

Creates and initializes a new socket sender.

Parameters
InSocketThe UDP socket to use for sending data.
ThreadDescriptionThe thread description text (for debugging).

◆ ~FUdpSocketSender()

virtual FUdpSocketSender::~FUdpSocketSender ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

◆ Exit()

virtual void FUdpSocketSender::Exit ( void  )
inlineoverridevirtual

Exits the runnable object.

Called in the context of the aggregating thread to perform any cleanup.

See also
Init, Run, Stop

Reimplemented from FRunnable.

◆ GetSendRate()

uint32 FUdpSocketSender::GetSendRate ( ) const
inline

Gets the maximum send rate (in bytes per second).

Returns
Current send rate.

◆ GetSingleThreadInterface()

virtual FSingleThreadRunnable * FUdpSocketSender::GetSingleThreadInterface ( )
inlineoverridevirtual

Gets single thread interface pointer used for ticking this runnable when multi-threading is disabled. If the interface is not implemented, this runnable will not be ticked when FPlatformProcess::SupportsMultithreading() is false.

Returns
Pointer to the single thread interface or nullptr if not implemented.

Reimplemented from FRunnable.

◆ GetThroughput()

uint32 FUdpSocketSender::GetThroughput ( ) const
inline

Gets the current throughput (in bytes per second).

Returns
Current throughput.

◆ Init()

virtual bool FUdpSocketSender::Init ( void  )
inlineoverridevirtual

Initializes the runnable object.

This method is called in the context of the thread object that aggregates this, not the thread that passes this runnable to a new thread.

Returns
True if initialization was successful, false otherwise
See also
Run, Stop, Exit

Reimplemented from FRunnable.

◆ Run()

virtual uint32 FUdpSocketSender::Run ( )
inlineoverridevirtual

Runs the runnable object.

This is where all per object thread work is done. This is only called if the initialization was successful.

Returns
The exit code of the runnable object
See also
Init, Stop, Exit

Implements FRunnable.

◆ Send()

bool FUdpSocketSender::Send ( const TSharedRef< TArray< uint8 >, ESPMode::ThreadSafe > &  Data,
const FIPv4Endpoint Recipient 
)
inline

Sends data to the specified recipient.

Parameters
DataThe data to send.
RecipientThe recipient.
Returns
true if the data will be sent, false otherwise.

◆ SetSendRate()

void FUdpSocketSender::SetSendRate ( uint32  Rate)
inline

Sets the send rate (in bytes per second).

Parameters
RateThe new send rate (0 = unlimited).
See also
SetWaitTime

◆ SetWaitTime()

void FUdpSocketSender::SetWaitTime ( const FTimespan Timespan)
inline

Sets the maximum time span to wait for work items.

Parameters
TimespanThe wait time.
See also
SetSendRate

◆ Stop()

virtual void FUdpSocketSender::Stop ( void  )
inlineoverridevirtual

Stops the runnable object.

This is called if a thread is requested to terminate early.

See also
Init, Run, Exit

Reimplemented from FRunnable.

◆ Tick()

virtual void FUdpSocketSender::Tick ( )
inlineoverrideprotectedvirtual

Implements FSingleThreadRunnable.

◆ Update()

bool FUdpSocketSender::Update ( const FTimespan SocketWaitTime)
inlineprotected

Update this socket sender.

Parameters
Timeto wait for the socket.
Returns
true on success, false otherwise.

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