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"
7
8
9
21{
22public:
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
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
60public:
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
100 {
101 }
102};
103
104
105// Type definition for shared references to instances of IPlatformHostSocket.
107
108// Type definition for shared pointers to instances of IPlatformHostSocket.
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
TSharedRef< IPlatformHostSocket, ESPMode::ThreadSafe > IPlatformHostSocketRef
Definition GenericPlatformHostSocket.h:106
TSharedPtr< IPlatformHostSocket, ESPMode::ThreadSafe > IPlatformHostSocketPtr
Definition GenericPlatformHostSocket.h:109
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition GenericPlatformHostSocket.h:21
EResultNet
Definition GenericPlatformHostSocket.h:29
virtual EResultNet Receive(void *Buffer, uint64 BytesToReceive)=0
EConnectionState
Definition GenericPlatformHostSocket.h:43
virtual ~IPlatformHostSocket()
Definition GenericPlatformHostSocket.h:99
virtual EConnectionState GetState() const =0
EReceiveFlags
Definition GenericPlatformHostSocket.h:55
virtual EResultNet Receive(void *Buffer, uint64 BytesToReceive, uint64 &BytesReceived, EReceiveFlags ReadMode=EReceiveFlags::WaitAll)=0
virtual EResultNet Send(const void *Buffer, uint64 BytesToSend)=0
Definition SharedPointer.h:692
Definition SharedPointer.h:153