![]() |
Open 3D Engine GridMate API Reference
2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
|
Inherits GridMate::SocketDriverCommon.
Inherited by GridMate::StreamSocketDriver.
Public Types | |
typedef AZStd::unordered_set< SocketDriverAddress, SocketDriverAddress::Hasher > | AddressSetType |
![]() | |
using | SocketType = Platform::SocketType_Platform |
![]() | |
enum | ErrorCodes { EC_OK = 0, EC_SOCKET_CREATE, EC_SOCKET_LISTEN, EC_SOCKET_CLOSE, EC_SOCKET_MAKE_NONBLOCK, EC_SOCKET_BIND, EC_SOCKET_SOCK_OPT, EC_SOCKET_CONNECT, EC_SOCKET_ACCEPT, EC_SECURE_CONFIG, EC_SECURE_CREATE, EC_SECURE_CERT, EC_SECURE_PKEY, EC_SECURE_CA_CERT, EC_SEND, EC_SEND_ADDRESS_NOT_BOUND, EC_RECEIVE, EC_PLATFORM = 1000, EC_BUFFER_TOOLARGE = 1001 } |
enum | BSDSocketFamilyType { BSD_AF_INET = 0, BSD_AF_INET6, BSD_AF_UNSPEC } |
typedef unsigned int | ResultCode |
Public Member Functions | |
GM_CLASS_ALLOCATOR (SocketDriver) | |
SocketDriver (bool isFullPackets, bool isCrossPlatform, bool isHighPerformance=false) | |
AZStd::intrusive_ptr< DriverAddress > | CreateDriverAddress (const AZStd::string &address) override |
AZStd::intrusive_ptr< DriverAddress > | CreateDriverAddress (const sockaddr *addr) override |
Additional CreateDriverAddress function should be implemented. | |
void | DestroyDriverAddress (DriverAddress *address) override |
Called only from the DriverAddress when the use count becomes 0. | |
![]() | |
SocketDriverCommon (bool isFullPackets=false, bool isCrossPlatform=false, bool isHighPerformance=false) | |
unsigned int | GetMaxNumConnections () const override |
Return maximum number of active connections at the same time. More... | |
unsigned int | GetMaxSendSize () const override |
Return maximum data size we can send/receive at once in bytes, supported by the platform. | |
unsigned int | GetPacketOverheadSize () const override |
Return packet overhead size in bytes. | |
ResultCode | Initialize (int familyType=BSD_AF_INET, const char *address=nullptr, unsigned int port=0, bool isBroadcast=false, unsigned int receiveBufferSize=0, unsigned int sendBufferSize=0) override |
unsigned int | GetPort () const override |
Returns communication port (must be called after Initialize, otherwise it will return 0) | |
ResultCode | Send (const AZStd::intrusive_ptr< DriverAddress > &to, const char *data, unsigned int dataSize) override |
Send data to a user defined address. | |
unsigned int | Receive (char *data, unsigned int maxDataSize, AZStd::intrusive_ptr< DriverAddress > &from, ResultCode *resultCode=0) override |
bool | WaitForData (AZStd::chrono::microseconds timeOut=AZStd::chrono::microseconds(0)) override |
void | StopWaitForData () override |
bool | WasStopeedWaitingForData () override |
Return true if WaitForData was interrupted before the timeOut expired, otherwise false. | |
AZStd::string | IPPortToAddress (const char *ip, unsigned int port) const override |
bool | AddressToIPPort (const AZStd::string &address, AZStd::string &ip, unsigned int &port) const override |
![]() | |
virtual void | Update () |
virtual void | ProcessIncoming () |
virtual void | ProcessOutgoing () |
virtual bool | CanSend () const |
Public Attributes | |
AddressSetType | m_addressMap |
Friends | |
class | SocketDriverAddress |
Additional Inherited Members | |
![]() | |
static AZStd::string | IPPortToAddressString (const char *ip, unsigned int port) |
Create address for the socket driver from IP and port. | |
static bool | AddressStringToIPPort (const AZStd::string &address, AZStd::string &ip, unsigned int &port) |
Decompose an address to IP and port. | |
static BSDSocketFamilyType | AddressFamilyType (const AZStd::string &ip) |
Return the family type of the address (AF_INET,AF_INET6 AF_UNSPEC) | |
static BSDSocketFamilyType | AddressFamilyType (const char *ip) |
![]() | |
virtual SocketType | CreateSocket (int af, int type, int protocol) |
returns result of socket(af,type,protocol) | |
virtual int | BindSocket (const sockaddr *sockAddr, size_t sockAddrLen) |
returns the result of bind(sockAddr) | |
virtual ResultCode | SetSocketOptions (bool isBroadcast, unsigned int receiveBufferSize, unsigned int sendBufferSize) |
set's default socket options | |
![]() | |
SocketType | m_socket |
unsigned short | m_port |
bool | m_isStoppedWaitForData |
True if last WaitForData was interrupted otherwise false. | |
bool | m_isFullPackets |
True if we use max packet size vs internet safe packet size (64KB vs 1500 usually) | |
bool | m_isCrossPlatform |
True if we support cross platform communication. Then we make sure we use common features. | |
bool | m_isIpv6 |
True if we use version 6 of the internet protocol, otherwise false. | |
bool | m_isDatagram |
True if the socket was created with SOCK_DGRAM. | |
AZStd::unique_ptr< PlatformSocketDriver > | m_platformDriver |
Platform specific implementation of socket calls. | |
bool | m_isHighPerformance |
True if using platform-specific high-performance implementation. | |
![]() | |
bool | m_canSend |
Can the driver accept more data. | |
|
overridevirtual |
Creates internal driver address to be used for send/receive calls.
Implements GridMate::SocketDriverCommon.