Open 3D Engine AzFramework API Reference
24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
|
#include <SocketConnection.h>
Inherited by AzFramework::AssetSystem::AssetProcessorConnection.
Public Types | |
enum class | EConnectionState { Connected , Connecting , Disconnected , Disconnecting , Listening } |
typedef AZStd::function< void(AZ::u32, AZ::u32, const void *, AZ::u32)> | TMessageCallback |
typedef AZ::u32 | TMessageCallbackHandle |
Public Member Functions | |
AZ_RTTI (SocketConnection, "{CF95282C-B514-4AB8-8C72-6063AD03725B}") | |
virtual bool | Connect (const char *address, AZ::u16 port)=0 |
virtual bool | Disconnect (bool completeDisconnect=false)=0 |
virtual bool | Listen (AZ::u16 port)=0 |
virtual EConnectionState | GetConnectionState () const =0 |
Get the current connection state. | |
virtual bool | IsConnected () const =0 |
virtual bool | IsDisconnected () const =0 |
virtual bool | SendMsg (AZ::u32 typeId, const void *dataBuffer, AZ::u32 dataLength)=0 |
Send a message across the connection by message id. | |
virtual bool | SendMsg (AZ::u32 typeId, AZ::u32 serial, const void *dataBuffer, AZ::u32 dataLength)=0 |
Send a message across the connection by message id. | |
virtual bool | SendRequest (AZ::u32 typeId, const void *dataBuffer, AZ::u32 dataLength, TMessageCallback handler)=0 |
Send a message and wait for the response. | |
virtual TMessageCallbackHandle | AddMessageHandler (AZ::u32 typeId, TMessageCallback callback)=0 |
virtual void | RemoveMessageHandler (AZ::u32 typeId, TMessageCallbackHandle callbackHandle)=0 |
Remove callback for specific typeId (allows multiple callbacks per id) | |
virtual AZ::s32 | GetLastResult () const |
Get the last socket result code from any socket call. | |
virtual AZStd::string | GetLastErrorMessage () const |
Get the last socket-related error from any socket call. | |
Static Public Member Functions | |
static SocketConnection * | GetInstance () |
Utility functions to get or set the one global instance of a SocketConnection. | |
static void | SetInstance (SocketConnection *instance) |
Static Public Attributes | |
static const TMessageCallbackHandle | s_invalidCallbackHandle = 0 |
SocketConnection - an interface for creating a socket connection using AzSocket
typedef AZStd::function<void(AZ::u32, AZ::u32, const void*, AZ::u32)> AzFramework::SocketConnection::TMessageCallback |
Callback parameters: Message ID, Serial, Data Buffer, Data Length Note that if the message is a request and it failed because of a protocol error (engine is shutting down for example) It is still guaranteed to be called, but will be called with 0, nullptr
|
pure virtual |
Add callback for specific typeId (allows multiple callbacks per id) This will be invoked when a complete message is received from the remote end
Implemented in AzFramework::AssetSystem::AssetProcessorConnection.
|
pure virtual |
Connect to an address with this connection. Takes a null-terminated string address and a port Currently this blocks until connected
Implemented in AzFramework::AssetSystem::AssetProcessorConnection.
|
pure virtual |
Disconnect from connection - Only works if actually connected completeDisconnect - True if this function should wait for the connection to be fully terminated before returning. False for async behavior.
Implemented in AzFramework::AssetSystem::AssetProcessorConnection.
|
pure virtual |
Listen for one connection on a port This does not block and will set state to listening until connected
Implemented in AzFramework::AssetSystem::AssetProcessorConnection.