gwnavruntime/visualdebug/amp/Amp_Socket.h Source File
Go to the documentation of this file.
23 #ifdef KY_ENABLE_SOCKETS
34 virtual ~SocketInterface() { }
35 virtual bool CreateStream(
bool listener) = 0;
36 virtual bool CreateDatagram(
bool broadcast) = 0;
37 virtual bool Bind() = 0;
38 virtual bool Listen(
int) = 0;
39 virtual bool Connect() = 0;
40 virtual bool Accept(
int timeoutMs) = 0;
41 virtual int Send(
const char*, UPInt)
const = 0;
42 virtual int Receive(
char*,
int)
const = 0;
43 virtual int SendBroadcast(
const char*, UPInt)
const = 0;
44 virtual int ReceiveBroadcast(
char*,
int)
const = 0;
45 virtual void SetListenPort(
UInt32) = 0;
46 virtual void SetBroadcastPort(
UInt32) = 0;
47 virtual void SetAddress(
UInt32,
const char*) = 0;
48 virtual void SetBlocking(
bool) = 0;
49 virtual void SetBroadcast(
bool) = 0;
51 virtual bool Shutdown(
int timeoutMsForOrderlyRelease) = 0;
52 virtual bool Startup() = 0;
53 virtual void Cleanup() = 0;
54 virtual int GetLastError()
const = 0;
55 virtual bool IsValid()
const = 0;
56 virtual bool IsListening()
const = 0;
57 virtual bool ShutdownListener(
int timeoutMsForOrderlyRelease) = 0;
58 virtual bool CheckAbort()
const = 0;
61 class SocketImplFactory
64 virtual ~SocketImplFactory() { }
65 virtual SocketInterface* Create() = 0;
66 virtual void Destroy(SocketInterface* socketImpl) = 0;
70 class DefaultSocketFactory :
public NewOverrideBase<Stat_Default_Mem>,
public SocketImplFactory
73 virtual ~DefaultSocketFactory() { }
74 virtual SocketInterface* Create()
78 virtual void Destroy(SocketInterface* socketImpl)
93 Socket(
bool initLib, SocketImplFactory* socketImplFactory);
97 bool CreateClient(
const char* ipAddress,
UInt32 port, String* errorMsg);
98 bool CreateServer(
UInt32 port, String* errorMsg);
100 void Destroy(
int timeoutMsForOrderlyRelease = 0);
102 bool Accept(
int timeoutMs);
104 int Send(
const char* dataBuffer, UPInt dataBufferSize, LogSilentMode silentMode = LOG_VERBOSE)
const;
106 int Receive(
char* dataBuffer,
int dataSize, LogSilentMode silentMode = LOG_VERBOSE)
const;
108 bool IsConnected()
const;
110 void SetBlocking(
bool blocking);
112 void SetLock(Lock* lock);
114 bool IsValid()
const;
116 bool CheckAbort()
const;
119 enum { SocketListenBacklog = 10 };
121 SocketImplFactory* SocketFactory;
122 SocketInterface* SocketImpl;
129 bool Shutdown(
int timeoutMsForOrderlyRelease);
134 class BroadcastSocket
137 BroadcastSocket(
bool initLib, SocketImplFactory* socketImplFactory);
139 bool Create(
UInt32 port,
bool broadcast);
141 int Broadcast(
const char* dataBuffer, UPInt dataBufferSize)
const;
142 int Receive(
char* dataBuffer,
int dataSize)
const;
144 int GetLastError()
const {
return SocketImpl->GetLastError(); }
147 SocketImplFactory* SocketFactory;
148 SocketInterface* SocketImpl;
153 #ifndef KY_AMP_CHANNEL_NAME
154 #define KY_AMP_CHANNEL_NAME "GwNavAmp"
161 #endif // KY_ENABLE_SOCKETS
std::uint32_t UInt32
uint32_t
Definition: SF_Types.h:137
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17