Navigation
API > API/Runtime > API/Runtime/Sockets
This is our abstract base class that hides the platform specific socket implementation
| Name | FSocket |
| Type | class |
| Header File | /Engine/Source/Runtime/Sockets/Public/Sockets.h |
| Include Path | #include "Sockets.h" |
Syntax
class FSocket : public TSharedFromThis< FSocket, ESPMode::ThreadSafe >
Inheritance Hierarchy
- TSharedFromThis< FSocket, ESPMode::ThreadSafe > → FSocket
- FSocket
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FSocket () |
Default constructor. | Sockets.h | |
FSocket
(
ESocketType InSocketType, |
Specifies the type of socket being created | Sockets.h | |
FSocket
(
ESocketType InSocketType, |
Sockets.h | ||
FSocket
(
ESocketType InSocketType, |
Specifies the type of socket being created | Sockets.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~FSocket() |
Virtual destructor. | Sockets.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Accepts a connection that is pending. | Sockets.h | ||
FSocket * Accept
(
FInternetAddr& OutAddr, |
Accepts a connection that is pending. | Sockets.h | |
bool Bind
(
const FInternetAddr& Addr |
Binds a socket to a network byte ordered address. | Sockets.h | |
bool Close() |
Closes the socket | Sockets.h | |
bool Connect
(
const FInternetAddr& Addr |
Connects a socket to a network byte ordered address. | Sockets.h | |
void GetAddress
(
FInternetAddr& OutAddr |
Reads the address the socket is bound to and returns it. | Sockets.h | |
ESocketConnectionState GetConnectionState() |
Determines the connection state of the socket. | Sockets.h | |
FString GetDescription () |
Get the debug description of the socket. | Sockets.h | |
bool GetPeerAddress
(
FInternetAddr& OutAddr |
Reads the address of the peer the socket is connected to. | Sockets.h | |
int32 GetPortNo () |
Reads the port this socket is bound to. | Sockets.h | |
FName GetProtocol () |
Get the type of protocol the socket is bound to | Sockets.h | |
| Get the type of protocol the socket is bound to | Sockets.h | ||
bool HasPendingConnection
(
bool& bHasPendingConnection |
Queries the socket to determine if there is a pending connection. | Sockets.h | |
bool HasPendingData
(
uint32& PendingDataSize |
Queries the socket to determine if there is pending data on the queue. | Sockets.h | |
bool JoinMulticastGroup
(
const FInternetAddr& GroupAddress, |
Joins this socket to the specified multicast group on the specified interface. | Sockets.h | |
bool JoinMulticastGroup
(
const FInternetAddr& GroupAddress |
Joins this socket to the specified multicast group. | Sockets.h | |
bool LeaveMulticastGroup
(
const FInternetAddr& GroupAddress |
Removes this UDP client from the specified multicast group. | Sockets.h | |
bool LeaveMulticastGroup
(
const FInternetAddr& GroupAddress, |
Removes this UDP client from the specified multicast group on the specified interface. | Sockets.h | |
bool Listen
(
int32 MaxBacklog |
Places the socket into a state to listen for incoming connections. | Sockets.h | |
virtual bool Recv
(
uint8* Data, |
Reads a chunk of data from a connected socket | Sockets.h | |
virtual bool RecvFrom
(
uint8* Data, |
Reads a chunk of data from the socket and gathers the source address. | Sockets.h | |
virtual bool RecvFromWithPktInfo
(
uint8* Data, |
Reads a chunk of data from the socket and gathers the source address and the destination using IP_PKTINFO | Sockets.h | |
virtual bool RecvMulti
(
FRecvMulti& MultiData, |
Reads multiple packets from the socket at once, gathering the source address and other optional platform specific data. | Sockets.h | |
virtual bool Send
(
const uint8* Data, |
Sends a buffer on a connected socket. | Sockets.h | |
virtual bool SendTo
(
const uint8* Data, |
Sends a buffer to a network byte ordered address. | Sockets.h | |
bool SetBroadcast
(
bool bAllowBroadcast |
Sets a socket into broadcast mode (UDP only). | Sockets.h | |
virtual bool SetIpPktInfo
(
bool bEnable |
Sets whether to enable IP_PKTINFO support | Sockets.h | |
bool SetLinger
(
bool bShouldLinger, |
Sets whether and how long a socket will linger after closing. | Sockets.h | |
bool SetMulticastInterface
(
const FInternetAddr& InterfaceAddress |
Sets the interface used to send outgoing multicast datagrams. | Sockets.h | |
bool SetMulticastLoopback
(
bool bLoopback |
Enables or disables multicast loopback on the socket (UDP only). | Sockets.h | |
bool SetMulticastTtl
(
uint8 TimeToLive |
Sets the time to live (TTL) for multicast datagrams. | Sockets.h | |
bool SetNoDelay
(
bool bIsNoDelay |
Sets this socket into TCP_NODELAY mode (TCP only). | Sockets.h | |
bool SetNonBlocking
(
bool bIsNonBlocking |
Sets this socket into non-blocking mode. | Sockets.h | |
bool SetReceiveBufferSize
(
int32 Size, |
Sets the size of the receive buffer to use. | Sockets.h | |
bool SetRecvErr
(
bool bUseErrorQueue |
Enables error queue support for the socket. | Sockets.h | |
virtual bool SetRetrieveTimestamp
(
bool bRetrieveTimestamp |
Sets whether to retrieve the system-level receive timestamp, for sockets | Sockets.h | |
bool SetReuseAddr
(
bool bAllowReuse |
Sets whether a socket can be bound to an address in use. | Sockets.h | |
bool SetSendBufferSize
(
int32 Size, |
Sets the size of the send buffer to use. | Sockets.h | |
bool Shutdown
(
ESocketShutdownMode Mode |
Shuts down the socket, making it unusable for reads and/or writes. | Sockets.h | |
bool Wait
(
ESocketWaitConditions::Type Condition, |
Blocks until the specified condition is met. | Sockets.h | |
bool WaitForPendingConnection
(
bool& bHasPendingConnection, |
Waits for a pending connection on the socket. | Sockets.h |