UDocumentation
UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GenericPlatformHostSocket.h
Go to the documentation of this file.
1
// Copyright Epic Games, Inc. All Rights Reserved.
2
3
#pragma once
4
5
#include "
CoreTypes.h
"
6
#include "
Templates/SharedPointer.h
"
7
8
9
20
class
IPlatformHostSocket
21
{
22
public
:
23
28
enum class
EResultNet
:
uint8
29
{
30
Ok
,
// Communication successful.
31
ErrorUnknown
,
// Unknown error.
32
ErrorInvalidArgument
,
// Incorrect parameters provided to a function (shouldn't happen assuming the socket object is valid).
33
ErrorInvalidConnection
,
// Incorrect socket id used (shouldn't happen assuming the socket object is valid).
34
ErrorInterrupted
,
// Data transfer interrupted e.g. a networking issue.
35
ErrorHostNotConnected
// Host PC is not connected (not connected yet or has already disconnected).
36
};
37
42
enum class
EConnectionState
:
uint8
43
{
44
Unknown
,
// Default state (shouldn't be returned).
45
Created
,
// Socket has been created by cannot communicate yet (no host pc connected yet).
46
Connected
,
// Socket ready for communication.
47
Disconnected
,
// Host PC has disconnected (no communication possible, socket should be closed).
48
Closed
,
// Socket has already been closed and shouldn't be used.
49
};
50
54
enum class
EReceiveFlags
:
uint8
55
{
56
DontWait
,
// Read as much there is on the wire up to the buffer size
57
WaitAll
,
// Block read and wait until the buffer is filled
58
};
59
60
public
:
61
69
virtual
EResultNet
Send
(
const
void
*
Buffer
,
uint64
BytesToSend) = 0;
70
78
virtual
EResultNet
Receive
(
void
*
Buffer
,
uint64
BytesToReceive) = 0;
79
89
virtual
EResultNet
Receive
(
void
*
Buffer
,
uint64
BytesToReceive,
uint64
& BytesReceived,
EReceiveFlags
ReadMode
=
EReceiveFlags::WaitAll
) = 0;
90
94
virtual
EConnectionState
GetState
()
const
= 0;
95
99
virtual
~IPlatformHostSocket
()
100
{
101
}
102
};
103
104
105
// Type definition for shared references to instances of IPlatformHostSocket.
106
typedef
TSharedRef<IPlatformHostSocket, ESPMode::ThreadSafe>
IPlatformHostSocketRef
;
107
108
// Type definition for shared pointers to instances of IPlatformHostSocket.
109
typedef
TSharedPtr<IPlatformHostSocket, ESPMode::ThreadSafe>
IPlatformHostSocketPtr
;
CoreTypes.h
uint64
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition
Platform.h:1117
SharedPointer.h
StaticCastSharedRef
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition
SharedPointer.h:127
IPlatformHostSocketRef
TSharedRef< IPlatformHostSocket, ESPMode::ThreadSafe > IPlatformHostSocketRef
Definition
GenericPlatformHostSocket.h:106
IPlatformHostSocketPtr
TSharedPtr< IPlatformHostSocket, ESPMode::ThreadSafe > IPlatformHostSocketPtr
Definition
GenericPlatformHostSocket.h:109
EPixelFormatCapabilities::Buffer
@ Buffer
uint8
uint8_t uint8
Definition
binka_ue_file_header.h:8
IPlatformHostSocket
Definition
GenericPlatformHostSocket.h:21
IPlatformHostSocket::EResultNet
EResultNet
Definition
GenericPlatformHostSocket.h:29
IPlatformHostSocket::EResultNet::ErrorUnknown
@ ErrorUnknown
IPlatformHostSocket::EResultNet::ErrorHostNotConnected
@ ErrorHostNotConnected
IPlatformHostSocket::EResultNet::Ok
@ Ok
IPlatformHostSocket::EResultNet::ErrorInvalidConnection
@ ErrorInvalidConnection
IPlatformHostSocket::EResultNet::ErrorInterrupted
@ ErrorInterrupted
IPlatformHostSocket::EResultNet::ErrorInvalidArgument
@ ErrorInvalidArgument
IPlatformHostSocket::Receive
virtual EResultNet Receive(void *Buffer, uint64 BytesToReceive)=0
IPlatformHostSocket::EConnectionState
EConnectionState
Definition
GenericPlatformHostSocket.h:43
IPlatformHostSocket::EConnectionState::Closed
@ Closed
IPlatformHostSocket::EConnectionState::Created
@ Created
IPlatformHostSocket::EConnectionState::Connected
@ Connected
IPlatformHostSocket::EConnectionState::Unknown
@ Unknown
IPlatformHostSocket::EConnectionState::Disconnected
@ Disconnected
IPlatformHostSocket::~IPlatformHostSocket
virtual ~IPlatformHostSocket()
Definition
GenericPlatformHostSocket.h:99
IPlatformHostSocket::GetState
virtual EConnectionState GetState() const =0
IPlatformHostSocket::EReceiveFlags
EReceiveFlags
Definition
GenericPlatformHostSocket.h:55
IPlatformHostSocket::EReceiveFlags::DontWait
@ DontWait
IPlatformHostSocket::EReceiveFlags::WaitAll
@ WaitAll
IPlatformHostSocket::Receive
virtual EResultNet Receive(void *Buffer, uint64 BytesToReceive, uint64 &BytesReceived, EReceiveFlags ReadMode=EReceiveFlags::WaitAll)=0
IPlatformHostSocket::Send
virtual EResultNet Send(const void *Buffer, uint64 BytesToSend)=0
TSharedPtr
Definition
SharedPointer.h:692
TSharedRef
Definition
SharedPointer.h:153
Engine
Source
Runtime
Core
Public
GenericPlatform
GenericPlatformHostSocket.h
Generated by
1.9.8