Navigation
API > API/Runtime > API/Runtime/Sockets
This is the base interface to abstract platform specific sockets API differences.
| Name | ISocketSubsystem |
| Type | class |
| Header File | /Engine/Source/Runtime/Sockets/Public/SocketSubsystem.h |
| Include Path | #include "SocketSubsystem.h" |
Syntax
class ISocketSubsystem
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
ISocketSubsystem() |
SocketSubsystem.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~ISocketSubsystem() |
SocketSubsystem.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| HostNameCache | TMap< FString, TSharedPtr< FInternetAddr > > | Stores a resolved IP address for a given host name | SocketSubsystem.h | |
| HostNameCacheSync | FCriticalSection | Used to provide threadsafe access to the host name cache | SocketSubsystem.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddHostNameToCache
(
const ANSICHAR* HostName, |
Stores the ip address with the matching host name | SocketSubsystem.h | |
int32 BindNextPort
(
FSocket* Socket, |
Bind to next available port. | SocketSubsystem.h | |
virtual TSharedRef< FInternetAddr > CreateInternetAddr
(
const FName ProtocolType |
Create a FInternetAddr of the desired protocol | SocketSubsystem.h | |
TSharedRef< FInternetAddr > CreateInternetAddr () |
Create a proper FInternetAddr representation | SocketSubsystem.h | |
virtual TSharedRef< FInternetAddr > CreateInternetAddr
(
uint32 Address, |
Create a proper FInternetAddr representation | SocketSubsystem.h | |
virtual TUniquePtr< FRecvMulti > CreateRecvMulti
(
int32 MaxNumPackets, |
Create a platform specific FRecvMulti representation | SocketSubsystem.h | |
virtual FResolveInfoCached * CreateResolveInfoCached
(
TSharedPtr< FInternetAddr > Addr |
Creates a resolve info cached struct to hold the resolved address | SocketSubsystem.h | |
FSocket * CreateSocket
(
const FName& SocketType, |
Creates a socket using the given protocol name. | SocketSubsystem.h | |
virtual FSocket * CreateSocket
(
const FName& SocketType, |
Creates a socket@Param SocketType type of socket to create (DGram, Stream, etc) | SocketSubsystem.h | |
virtual FSocket * CreateSocket
(
const FName& SocketType, |
Creates a socket@Param SocketType type of socket to create (DGram, Stream, etc) | SocketSubsystem.h | |
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. | SocketSubsystem.h | |
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. | SocketSubsystem.h | |
void DestroySocket
(
FSocket* Socket |
Cleans up a socket class | SocketSubsystem.h | |
TSharedPtr< FInternetAddr > GetAddressFromString
(
const FString& InAddress |
Serializes a string that only contains an address. | SocketSubsystem.h | |
FAddressInfoResult GetAddressInfo
(
const TCHAR* HostName, |
Gets the address information of the given hostname and outputs it into an array of resolvable addresses. | SocketSubsystem.h | |
virtual FAddressInfoResult GetAddressInfo
(
const TCHAR* HostName, |
Gets the address information of the given hostname and outputs it into an array of resolvable addresses. | SocketSubsystem.h | |
virtual 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. | SocketSubsystem.h | |
virtual FResolveInfo * GetHostByName
(
const ANSICHAR* HostName |
Creates a platform specific async hostname resolution object | SocketSubsystem.h | |
virtual ESocketErrors GetHostByName
(
const ANSICHAR* HostName, |
Does a DNS look up of a host name This code assumes a lot, and as such, it's not guaranteed that the results provided by it are correct. | SocketSubsystem.h | |
bool GetHostByNameFromCache
(
const ANSICHAR* HostName, |
Checks the host name cache for an existing entry (faster than resolving again) | SocketSubsystem.h | |
bool GetHostName
(
FString& HostName |
Determines the name of the local machine | SocketSubsystem.h | |
ESocketErrors GetLastErrorCode() |
Returns the last error that has happened | SocketSubsystem.h | |
virtual bool GetLocalAdapterAddresses
(
TArray< TSharedPtr< FInternetAddr > >& OutAddresses |
Gets the list of addresses associated with the adapters on the local computer. | SocketSubsystem.h | |
virtual TSharedRef< FInternetAddr > GetLocalBindAddr
(
FOutputDevice& Out |
Get a local IP to bind to. | SocketSubsystem.h | |
virtual TArray< TSharedRef< FInternetAddr > > GetLocalBindAddresses () |
Get bindable addresses that this machine can use as reported by GetAddressInfo with the BindableAddress flag. | SocketSubsystem.h | |
virtual TSharedRef< FInternetAddr > GetLocalHostAddr
(
FOutputDevice& Out, |
Uses the platform specific look up to determine the host address | SocketSubsystem.h | |
virtual bool GetMultihomeAddress
(
TSharedRef< FInternetAddr >& Addr |
Returns the multihome address if the flag is present and valid. | SocketSubsystem.h | |
const TCHAR * GetSocketAPIName() |
Get the name of the socket subsystem | SocketSubsystem.h | |
const TCHAR * GetSocketError
(
ESocketErrors Code |
Returns a human readable string from an error code | SocketSubsystem.h | |
bool HasNetworkDevice() |
SocketSubsystem.h | ||
bool Init
(
FString& Error |
Does per platform initialization of the sockets library | SocketSubsystem.h | |
virtual bool IsRecvFromWithPktInfoSupported() |
Returns true if FSocket::RecvFromWithPktInfo is supported by this socket subsystem. | SocketSubsystem.h | |
virtual bool IsSocketRecvMultiSupported() |
Returns true if FSocket::RecvMulti is supported by this socket subsystem | SocketSubsystem.h | |
bool IsSocketWaitSupported() |
Returns true if FSocket::Wait is supported by this socket subsystem. | SocketSubsystem.h | |
void RemoveHostNameFromCache
(
const ANSICHAR* HostName |
Removes the host name to ip mapping from the cache | SocketSubsystem.h | |
bool RequiresChatDataBeSeparate () |
Some platforms require chat data (voice, text, etc.) to be placed into packets in a special way. | SocketSubsystem.h | |
bool RequiresEncryptedPackets () |
Some platforms require packets be encrypted. | SocketSubsystem.h | |
void Shutdown() |
Performs platform specific socket clean up | SocketSubsystem.h | |
ESocketErrors TranslateErrorCode
(
int32 Code |
Translates the platform error code to a ESocketErrors enum | SocketSubsystem.h | |
virtual double TranslatePacketTimestamp
(
const FPacketTimestamp& Timestamp, |
Converts a platform packet timestamp, into a local timestamp, or into a time delta etc. | SocketSubsystem.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ESocketProtocolFamily GetProtocolFamilyFromName
(
const FName& InProtocolName |
Conversion functions from the SocketProtocolFamily enum to the new FName system. | SocketSubsystem.h | |
virtual FName GetProtocolNameFromFamily
(
ESocketProtocolFamily InProtocolFamily |
SocketSubsystem.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static ISocketSubsystem * Get
(
const FName& SubsystemName |
Get the singleton socket subsystem for the given named subsystem | SocketSubsystem.h | |
static void ShutdownAllSystems() |
Shutdown all registered subsystems | SocketSubsystem.h |