14#include <AUI/Network.h>
16#include "AInet4Address.h"
17#include "AUI/Common/AString.h"
23class API_AUI_NETWORK AAbstractSocket {
29 static AString getErrorString();
31 [[nodiscard]]
inline int getHandle()
const {
return mHandle; }
33 static void handleError(
const AString& message,
int code);
35 AAbstractSocket(
int handle,
const AInet4Address& selfAddress) : mHandle(handle), mSelfAddress(selfAddress) {}
46 void bind(uint16_t bindingPort);
55 AAbstractSocket(
const AAbstractSocket&) =
delete;
57 virtual ~AAbstractSocket();
60 void setTimeout(
int secs);
62 const AInet4Address& getAddress()
const {
return mSelfAddress; }
void bind(uint16_t bindingPort)
Binds socket for port. Used for ATcpServerSocket and AUdpSocket.
Definition AAbstractSocket.cpp:115
virtual int createSocket()=0
Creates socket handle.
void init()
Initialise socket.
Definition AAbstractSocket.cpp:59
Represents an ipv4 address with port.
Definition AInet4Address.h:25
Represents a Unicode character string.
Definition AString.h:37