Navigation
API > API/Runtime > API/Runtime/Sockets
Inheritance Hierarchy
- ISocketSubsystem
- FSocketSubsystemEOS
- FSteamSocketsSubsystem
References
| Module | Sockets |
| Header | /Engine/Source/Runtime/Sockets/Public/SocketSubsystem.h |
| Include | #include "SocketSubsystem.h" |
Syntax
class ISocketSubsystem
Remarks
This is the base interface to abstract platform specific sockets API differences.
Destructors
| Type | Name | Description | |
|---|---|---|---|
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AddHostNameToCache
(
const ANSICHAR* HostName, |
Stores the ip address with the matching host name | |
| int32 | BindNextPort
(
FSocket* Socket, |
Bind to next available port. | |
| TSharedRef< FInternetAddr > | CreateInternetAddr
(
const FName ProtocolType |
Create a FInternetAddr of the desired protocol | |
| TSharedRef< FInternetAddr > | Create a proper FInternetAddr representation | ||
| TUniquePtr< FRecvMulti > | CreateRecvMulti
(
int32 MaxNumPackets, |
Create a platform specific FRecvMulti representation | |
| FResolveInfoCached * | CreateResolveInfoCached
(
TSharedPtr< FInternetAddr > Addr |
Creates a resolve info cached struct to hold the resolved address | |
| FSocket * | CreateSocket
(
const FName& SocketType, |
Creates a socket using the given protocol name. | |
| FSocket * | CreateSocket
(
const FName& SocketType, |
Creates a socketSocketType type of socket to create (DGram, Stream, etc) | |
| FUniqueSocket | CreateUniqueSocket
(
const FName& SocketType, |
Creates a socket using the given protocol name, wrapped in a unique pointer that will call DestroySocket automatically - do not call it explicitly! This SocketSubsystem must also outlive the sockets it creates. | |
| FUniqueSocket | CreateUniqueSocket
(
const FName& SocketType, |
Creates a socket wrapped in a unique pointer that will call DestroySocket automatically - do not call it explicitly! This SocketSubsystem must also outlive the sockets it creates. | |
| void | DestroySocket
(
FSocket* Socket |
Cleans up a socket class | |
| ISocketSubsystem * | Get the singleton socket subsystem for the given named subsystem | ||
| TSharedPtr< FInternetAddr > | GetAddressFromString
(
const FString& InAddress |
Serializes a string that only contains an address. | |
| FAddressInfoResult | GetAddressInfo
(
const TCHAR* HostName, |
Gets the address information of the given hostname and outputs it into an array of resolvable addresses. | |
| void | GetAddressInfoAsync
(
FAsyncGetAddressInfoCallback Callback, |
Async variant of GetAddressInfo that fetches the data from the above function in an asynchronous task executed on an available background thread. | |
| FResolveInfo * | GetHostByName
(
const ANSICHAR* HostName |
Creates a platform specific async hostname resolution object | |
| bool | GetHostByNameFromCache
(
const ANSICHAR* HostName, |
Checks the host name cache for an existing entry (faster than resolving again) | |
| bool | GetHostName
(
FString& HostName |
Determines the name of the local machine | |
| ESocketErrors | Returns the last error that has happened | ||
| bool | GetLocalAdapterAddresses
(
TArray< TSharedPtr< FInternetAddr >>& OutAddresses |
Gets the list of addresses associated with the adapters on the local computer. | |
| TSharedRef< FInternetAddr > | GetLocalBindAddr
(
FOutputDevice& Out |
Get a local IP to bind to. | |
| TArray< TSharedRef< FInternetAddr > > | Get bindable addresses that this machine can use as reported by GetAddressInfo with the BindableAddress flag. | ||
| TSharedRef< FInternetAddr > | GetLocalHostAddr
(
FOutputDevice& Out, |
Uses the platform specific look up to determine the host address | |
| bool | GetMultihomeAddress
(
TSharedRef< FInternetAddr >& Addr |
Returns the multihome address if the flag is present and valid. | |
| ESocketProtocolFamily | GetProtocolFamilyFromName
(
const FName& InProtocolName |
Conversion functions from the SocketProtocolFamily enum to the new FName system. | |
| FName | GetProtocolNameFromFamily
(
ESocketProtocolFamily InProtocolFamily |
||
| const TCHAR * | Get the name of the socket subsystem | ||
| const TCHAR * | GetSocketError
(
ESocketErrors Code |
Returns a human readable string from an error code | |
| bool | |||
| bool | Does per platform initialization of the sockets library | ||
| bool | Returns true if FSocket::RecvFromWithPktInfo is supported by this socket subsystem. | ||
| bool | Returns true if FSocket::RecvMulti is supported by this socket subsystem | ||
| bool | Returns true if FSocket::Wait is supported by this socket subsystem. | ||
| void | RemoveHostNameFromCache
(
const ANSICHAR* HostName |
Removes the host name to ip mapping from the cache | |
| bool | Some platforms require chat data (voice, text, etc.) to be placed into packets in a special way. | ||
| bool | Some platforms require packets be encrypted. | ||
| void | Shutdown () |
Performs platform specific socket clean up | |
| void | Shutdown all registered subsystems | ||
| ESocketErrors | TranslateErrorCode
(
int32 Code |
Translates the platform error code to a ESocketErrors enum | |
| double | TranslatePacketTimestamp
(
const FPacketTimestamp& Timestamp, |
Converts a platform packet timestamp, into a local timestamp, or into a time delta etc. |
Deprecated Functions
| Type | Name | Description | |
|---|---|---|---|
| TSharedRef< FInternetAddr > | CreateInternetAddr
(
uint32 Address, |
To support different address sizes, use CreateInternetAddr with no arguments and call SetIp/SetRawIp and SetPort on the returned object | |
| FSocket * | CreateSocket
(
const FName& SocketType, |
Use the CreateSocket with the FName parameter for support for multiple protocol types. | |
| FAddressInfoResult | GetAddressInfo
(
const TCHAR* HostName, |
Migrate to GetAddressInfo that takes an FName as the protocol specification. | |
| ESocketErrors | GetHostByName
(
const ANSICHAR* HostName, |
Please use GetAddressInfo to query hostnames |