47 #ifndef AGXNET_SOCKET_H
48 #define AGXNET_SOCKET_H
52 # pragma warning( disable : 4290)
53 # pragma warning( disable: 4275 ) // warning C4275: non dll-interface class
91 NetError(
Socket *socket) : std::runtime_error(
"Connection closed"), m_socket(socket) {}
156 return (this->m_host == ip.m_host) && (this->m_port == ip.m_port);
181 std::ostream&
operator<<(std::ostream& stream,
const IPAddress& adr);
216 SINGLETON_CLASSNAME_METHOD();
223 void deinitSockets();
242 #ifndef DOC_DONT_EXTRACT //direction to doxygen not to extract this class
246 #endif//~DOC_DONT_EXTRACT
257 void setBlocking(
bool flag);
270 return m_readyToReceive;
277 return m_readyToReceive;
282 return m_readyToSend;
348 this->open(ip, disableNaggle);
368 void open(
const IPAddress& ip,
bool disableNaggle =
false);
397 void disableNaggle();
448 this->open(port, disableNaggle);
457 void open(
agx::UInt16 port,
bool disableNaggle =
false);
470 bool m_disableNaggle;
538 size_t getMaxSockets()
const;
545 bool addSocket(
Socket *sock);
552 bool removeSocket(
Socket *sock);
586 SocketRefVector m_set;
a structure which holds IP address
TCPServerSocket & operator=(const TCPServerSocket &s)
Assignment operator, works similar to std::auto_ptr::operator=().
std::ostream & operator<<(std::ostream &stream, const IPAddress &adr)
void AGXPHYSICS_EXPORT shutdown()
Shutdown agx.
IPAddress(agx::UInt32 h, agx::UInt16 p)
Create IP address specifying exact ip address and port number.
static agx::String parseString(agx::UInt8 *&buffer, agx::UInt8 *)
bool operator==(const IPAddress &ip)
compares two IP addresses for equality.
const SocketRefVector & getSockets() const
bool readyToReceive() const
const agx::UInt32 & host() const
const IPAddress & adr() const
virtual ~SocketSet()
Destroys the socket set.
#define AGX_DECLARE_POINTER_TYPES(type)
Base class providing referencing counted objects.
SystemIndependentSocketHandle m_socket
Socket & operator=(const Socket &s)
size_t getNumSockets() const
Returns number of sockets the socket set currently holds.
TCPServerSocket(agx::UInt16 port, bool disableNaggle=false)
A constructor which automatically calls TCPServerSocket::Open() method.
TCPServerSocket()
Creates an invalid (unopened) TCP server socket.
IPAddress(agx::UInt8 h1, agx::UInt8 h2, agx::UInt8 h3, agx::UInt8 h4, agx::UInt16 p)
Create IP address specifying exact ip address as 4 bytes and port number.
agx::UInt16 AGXCORE_EXPORT getAvailablePort()
TCPServerSocket(const TCPServerSocket &s)
A copy constructor.
TCPSocket & operator=(const TCPSocket &s)
Assignment operator, works similar to std::auto_ptr::operator=().
bool isReady() const
Tells whether there is some activity on the socket or not.
GLenum GLuint GLenum GLsizei const GLchar * message
virtual ~Socket()
Destructor.
AGX_DECLARE_VECTOR_TYPES(Socket)
TCPSocket()
Constructs an invalid TCP socket object.
NetError(const char *message)
Exception constructor.
TCPSocket(const TCPSocket &s, const IPAddress &adr=IPAddress())
A copy constructor.
TCPSocket(const IPAddress &ip, bool disableNaggle=false)
A constructor which automatically calls TCPSocket::Open() method.
Base class for Singletons that should have its shutdown called explicitly before exit of the applicat...
const agx::UInt16 & port() const