Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
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
10
/**
11
* Interface for sockets supporting direct communication between the game running
12
* on the target device and a connected PC.
13
*
14
* It represents a custom communication channel and may not be implemented on all platforms.
15
*
16
* It is meant to be used in development ONLY.
17
*
18
* @see IPlatformHostCommunication
19
*/
20
class
IPlatformHostSocket
21
{
22
public
:
23
24
/**
25
* Status values returned by Send and Receive members.
26
* @see Send, Receive
27
*/
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
38
/**
39
* State of the socket determining its ability to send/receive data.
40
* @see GetState
41
*/
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
51
public
:
52
53
/**
54
* Send data to the connected host PC (blocking operation).
55
*
56
* @param Buffer Data to be sent.
57
* @param BytesToSend The number of bytes to send.
58
* @return Status value indicating error or success.
59
*/
60
virtual
EResultNet
Send
(
const
void
* Buffer, uint64 BytesToSend) = 0;
61
62
/**
63
* Receive data from the connected host PC (blocking operation).
64
*
65
* @param Buffer Data to be sent.
66
* @param BytesToReceive The number of bytes to receive (Buffer has to be large enough).
67
* @return Status value indicating error or success.
68
*/
69
virtual
EResultNet
Receive
(
void
* Buffer, uint64 BytesToReceive) = 0;
70
71
/**
72
* Get the state of the socket (determines if the host pc is connected and communication is possible).
73
*/
74
virtual
EConnectionState
GetState
()
const
= 0;
75
76
/**
77
* Destructor.
78
*/
79
virtual
~
IPlatformHostSocket
()
80
{
81
}
82
};
83
84
85
// Type definition for shared references to instances of IPlatformHostSocket.
86
typedef
TSharedRef
<
IPlatformHostSocket
,
ESPMode
::
ThreadSafe
>
IPlatformHostSocketRef
;
87
88
// Type definition for shared pointers to instances of IPlatformHostSocket.
89
typedef
TSharedPtr
<
IPlatformHostSocket
,
ESPMode
::
ThreadSafe
>
IPlatformHostSocketPtr
;
IPlatformHostSocketRef
TSharedRef< IPlatformHostSocket, ESPMode::ThreadSafe > IPlatformHostSocketRef
Definition
GenericPlatformHostSocket.h:86
IPlatformHostSocketPtr
TSharedPtr< IPlatformHostSocket, ESPMode::ThreadSafe > IPlatformHostSocketPtr
Definition
GenericPlatformHostSocket.h:89
ESPMode
ESPMode
Definition
SharedPointerFwd.h:12
ESPMode::ThreadSafe
@ ThreadSafe
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:79
IPlatformHostSocket::GetState
virtual EConnectionState GetState() const =0
IPlatformHostSocket::Send
virtual EResultNet Send(const void *Buffer, uint64 BytesToSend)=0
TSharedPtr
Definition
SharedPointer.h:686
TSharedRef
Definition
SharedPointer.h:163
Downloads
ArkServerAPI_NEW
ASA
AsaApi
AsaApi
Core
Public
API
UE
GenericPlatform
GenericPlatformHostSocket.h
Generated by
1.10.0