29 #include <sys/types.h>
38 bool GNet::Socket::setNonBlock()
42 int mode = ::fcntl( m_socket.fd() , F_GETFL ) ;
46 int rc = ::fcntl( m_socket.fd() , F_SETFL , mode | O_NONBLOCK ) ;
50 G_ASSERT( ::fcntl(m_socket.fd(),F_GETFL) & O_NONBLOCK ) ;
59 G_DEBUG(
"GNet::Socket::reason: " << (r==EINPROGRESS?
"":
"error ") << r <<
": " << std::strerror(r) ) ;
63 void GNet::Socket::doClose()
66 ::close( m_socket.fd() ) ;
82 return m_reason == EWOULDBLOCK || m_reason == EAGAIN ;
87 return m_reason == EINPROGRESS ;
92 return m_reason == EMSGSIZE ;
102 return bind( address ) ;
bool canBindHint(const Address &address)
Returns true if the socket can probably be bound with the given address.
static Descriptor invalid()
Returns an invalid descriptor.
bool eWouldBlock()
Returns true if the previous socket operation failed with the EWOULDBLOCK or EGAIN error status...
The Address class encapsulates an IP transport address.
A network file descriptor.
static bool sizeError(ssize_type size)
bool eMsgSize()
Returns true if the previous socket operation failed with the EMSGSIZE error status.
bool valid() const
Returns true if the descriptor is valid.
bool eInProgress()
Returns true if the previous socket operation failed with the EINPROGRESS error status.
bool valid() const
Returns true if the socket handle is valid (open).
static bool error(int rc)