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

#include <UdpSocketReceiver.h>

+ Inheritance diagram for FUdpSocketReceiver:

Public Member Functions

 FUdpSocketReceiver (FSocket *InSocket, const FTimespan &InWaitTime, const TCHAR *InThreadName)
 
virtual ~FUdpSocketReceiver ()
 
void SetMaxReadBufferSize (uint32 InMaxReadBufferSize)
 
void SetThreadStackSize (uint32 InTheadStackSize)
 
void Start ()
 
FOnSocketDataReceivedOnDataReceived ()
 
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

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

Detailed Description

Asynchronously receives data from an UDP socket.

Constructor & Destructor Documentation

◆ FUdpSocketReceiver()

FUdpSocketReceiver::FUdpSocketReceiver ( FSocket InSocket,
const FTimespan InWaitTime,
const TCHAR InThreadName 
)
inline

Creates and initializes a new socket receiver.

Parameters
InSocketThe UDP socket to receive data from.
InWaitTimeThe amount of time to wait for the socket to be readable.
InThreadNameThe receiver thread name (for debugging).

◆ ~FUdpSocketReceiver()

virtual FUdpSocketReceiver::~FUdpSocketReceiver ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

◆ Exit()

virtual void FUdpSocketReceiver::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.

◆ GetSingleThreadInterface()

virtual FSingleThreadRunnable * FUdpSocketReceiver::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.

◆ Init()

virtual bool FUdpSocketReceiver::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.

◆ OnDataReceived()

FOnSocketDataReceived & FUdpSocketReceiver::OnDataReceived ( )
inline

Returns a delegate that is executed when data has been received.

This delegate must be bound before the receiver thread is started with the Start() method. It cannot be unbound while the thread is running.

Returns
The delegate.

◆ Run()

virtual uint32 FUdpSocketReceiver::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.

◆ SetMaxReadBufferSize()

void FUdpSocketReceiver::SetMaxReadBufferSize ( uint32  InMaxReadBufferSize)
inline

Set the maximum size allocated to read off of the socket.

◆ SetThreadStackSize()

void FUdpSocketReceiver::SetThreadStackSize ( uint32  InTheadStackSize)
inline

Set the desired Thread Stack Size. Only read when Start() is called.

◆ Start()

void FUdpSocketReceiver::Start ( )
inline

Start the receiver thread.

◆ Stop()

virtual void FUdpSocketReceiver::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 FUdpSocketReceiver::Tick ( )
inlineoverrideprotectedvirtual

Implements FSingleThreadRunnable.

◆ Update()

void FUdpSocketReceiver::Update ( const FTimespan SocketWaitTime)
inlineprotected

Update this socket receiver.


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