![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <Sockets.h>
Inheritance diagram for FSocket:Protected Attributes | |
| const ESocketType | SocketType |
| FString | SocketDescription |
| FName | SocketProtocol |
Additional Inherited Members | |
Protected Member Functions inherited from TSharedFromThis< FSocket, ESPMode::ThreadSafe > | |
| TSharedFromThis () | |
| TSharedFromThis (TSharedFromThis const &) | |
| UE_FORCEINLINE_HINT TSharedFromThis & | operator= (TSharedFromThis const &) |
| ~TSharedFromThis () | |
Static Protected Member Functions inherited from TSharedFromThis< FSocket, ESPMode::ThreadSafe > | |
| static UE_FORCEINLINE_HINT TSharedRef< OtherType, Mode > | SharedThis (OtherType *ThisPtr) |
| static UE_FORCEINLINE_HINT TSharedRef< OtherType const, Mode > | SharedThis (const OtherType *ThisPtr) |
This is our abstract base class that hides the platform specific socket implementation
| FSocket::FSocket | ( | ) |
Default constructor.
|
inline |
Specifies the type of socket being created
| InSocketType | The type of socket being created |
| InSocketDescription | The debug description of the socket |
|
inline |
| FSocket::FSocket | ( | ESocketType | InSocketType, |
| const FString & | InSocketDescription, | ||
| const FName & | InSocketProtocol | ||
| ) |
Specifies the type of socket being created
| InSocketType | The type of socket being created |
| InSocketDescription | The debug description of the socket |
| InSocketProtocol | the protocol stack this socket should be created on. |
|
virtualdefault |
Virtual destructor.
Accepts a connection that is pending.
| SocketDescription | Debug description of socket, |
|
pure virtual |
Accepts a connection that is pending.
| OutAddr | The address of the connection. |
| SocketDescription | Debug description of socket. |
|
pure virtual |
Binds a socket to a network byte ordered address.
| Addr | The address to bind to. |
Closes the socket
|
pure virtual |
Connects a socket to a network byte ordered address.
| Addr | The address to connect to. |
|
pure virtual |
Reads the address the socket is bound to and returns it.
| OutAddr | The address the socket is bound to. |
|
pure virtual |
Determines the connection state of the socket.
|
inline |
|
pure virtual |
Reads the address of the peer the socket is connected to.
| OutAddr | Address of the peer the socket is connected to. |
|
inline |
Get the type of protocol the socket is bound to
|
inline |
Get the type of protocol the socket is bound to
Queries the socket to determine if there is a pending connection.
| bHasPendingConnection | Will indicate whether a connection is pending or not. |
Queries the socket to determine if there is pending data on the queue.
| PendingDataSize | Will indicate how much data is on the pipe for a single recv call. |
|
pure virtual |
Joins this socket to the specified multicast group.
The multicast group address must be in the range 224.0.0.0 to 239.255.255.255.
| GroupAddress | The IP address of the multicast group. |
|
pure virtual |
Joins this socket to the specified multicast group on the specified interface.
The multicast group address must be in the range 224.0.0.0 to 239.255.255.255.
| GroupAddress | The IP address of the multicast group. |
| InterfaceAddress | The address representing the interface. |
|
pure virtual |
Removes this UDP client from the specified multicast group.
| The | multicast group address to leave. |
|
pure virtual |
Removes this UDP client from the specified multicast group on the specified interface.
| GroupAddress | The multicast group address to leave. |
| InterfaceAddress | The address representing the interface. |
Places the socket into a state to listen for incoming connections.
| MaxBacklog | The number of connections to queue before refusing them. |
|
virtual |
Reads a chunk of data from a connected socket
A return value of 'true' does not necessarily mean that data was returned. Callers must check the 'BytesRead' parameter for the actual amount of data returned. A value of zero indicates that there was no data available for reading.
| Data | The buffer to read into |
| BufferSize | The max size of the buffer |
| BytesRead | Will indicate how many bytes were read from the socket |
| Flags | the receive flags |
|
virtual |
Reads a chunk of data from the socket and gathers the source address.
A return value of 'true' does not necessarily mean that data was returned. Callers must check the 'BytesRead' parameter for the actual amount of data returned. A value of zero indicates that there was no data available for reading.
| Data | The buffer to read into. |
| BufferSize | The max size of the buffer. |
| BytesRead | Will indicate how many bytes were read from the socket. |
| Source | Will contain the receiving the address of the sender of the data. |
| Flags | The receive flags. |
|
virtual |
Reads a chunk of data from the socket and gathers the source address and the destination using IP_PKTINFO
A return value of 'true' does not necessarily mean that data was returned. Callers must check the 'BytesRead' parameter for the actual amount of data returned. A value of zero indicates that there was no data available for reading.
| Data | The buffer to read into. |
| BufferSize | The max size of the buffer. |
| BytesRead | Will indicate how many bytes were read from the socket. |
| Source | Will contain the receiving the address of the sender of the data. |
| Destination | Will contain the destination address used by the sender of the data. |
| Flags | The receive flags. |
|
virtual |
Reads multiple packets from the socket at once, gathering the source address and other optional platform specific data. Use ISocketSubsystem::IsSocketRecvMultiSupported to check if the current socket platform supports this. NOTE: For optimal performance, one FRecvMulti instance should be used, for the lifetime of the socket.
| MultiData | The FRecvMulti instance that receives packet data and holds platform specific buffers for receiving data. |
| Flags | The receive flags. |
Releases the underlying socket implementation for use with native APIs. The user of this class must know the underlying implementation details in order to cast the return value properly. If this function succeeds, the FSocket instance no longer controls the connection (it will not Close()).
Sends a buffer on a connected socket.
| Data | The buffer to send. |
| Count | The size of the data to send. |
| BytesSent | Will indicate how much was sent. |
|
virtual |
Sends a buffer to a network byte ordered address.
| Data | The buffer to send. |
| Count | The size of the data to send. |
| BytesSent | Will indicate how much was sent. |
| Destination | The network byte ordered address to send to. |
Sets a socket into broadcast mode (UDP only).
| bAllowBroadcast | Whether to enable broadcast or not. |
Sets whether to enable IP_PKTINFO support
| bEnable | Whether to enable/disable |
Sets whether and how long a socket will linger after closing.
| bShouldLinger | Whether to have the socket remain open for a time period after closing or not. |
| Timeout | The amount of time to linger before closing. |
|
pure virtual |
Sets the interface used to send outgoing multicast datagrams.
Multicast traffic is sent using the default interface, this allows to explicitly set the interface used to send outgoing multicast datagrams.
| InterfaceAddress | The interface address. |
Enables or disables multicast loopback on the socket (UDP only).
This setting determines whether multicast datagrams are looped back to the sending socket. By default, multicast loopback is enabled. It must be enabled if more than one listener is present on a host.
| bLoopback | Whether loopback should be enabled. |
Sets the time to live (TTL) for multicast datagrams.
The default TTL for multicast datagrams is 1, which prevents them from being forwarded beyond the local subnet. Higher values will allow multicast datagrams to be sent into neighboring subnets, if multicast capable routers are present.
| TimeToLive | Number of hops the datagram can make. |
Sets this socket into TCP_NODELAY mode (TCP only).
| bIsNoDelay | Whether to enable no delay mode. |
Sets this socket into non-blocking mode.
| bIsNonBlocking | Whether to enable blocking or not. |
Sets the size of the receive buffer to use.
| Size | The size to change it to. |
| NewSize | Will contain the size that was set (in case OS can't set that). |
Enables error queue support for the socket.
| bUseErrorQueue | Whether to enable error queuing or not. |
Sets whether to retrieve the system-level receive timestamp, for sockets
| bRetrieveTimestamp | Whether to retrieve the timestamp upon receive |
Sets whether a socket can be bound to an address in use.
| bAllowReuse | Whether to allow reuse or not. |
Sets the size of the send buffer to use.
| Size | The size to change it to. |
| NewSize | Will contain the size that was set (in case OS can't set that). |
|
pure virtual |
Shuts down the socket, making it unusable for reads and/or writes. This does not close the socket!
| Types |
|
pure virtual |
Blocks until the specified condition is met.
| Condition | The condition to wait for. |
| WaitTime | The maximum time to wait. |
|
pure virtual |
Waits for a pending connection on the socket.
| out | bHasPendingConnection Will indicate whether a connection is pending or not. |
| WaitTime | The maximum time to wait for a connection. If zero, the function will not wait and will return immediately with a value in bHasPendingConnection. |
|
protected |
Debug description of socket usage.
|
protected |
Protocol used in creation of a socket
|
protected |
Indicates the type of socket this is