blocxx
BLOCXX_NAMESPACE::SocketUtils Namespace Reference

Functions

String inetAddrToString (UInt64 addr)
 
int waitForIO (SocketHandle_t fd, int timeOutSecs, SocketFlags::EWaitDirectionFlag forInput) BLOCXX_DEPRECATED
 Wait for input or output on a socket.
 
int waitForIO (SocketHandle_t fd, const Timeout &timeout, SocketFlags::EWaitDirectionFlag forInput)
 Wait for input or output on a socket.
 
String getFullyQualifiedHostName ()
 Get the fully qualified host name.
 

Function Documentation

◆ getFullyQualifiedHostName()

BLOCXX_COMMON_API String BLOCXX_NAMESPACE::SocketUtils::getFullyQualifiedHostName ( )

Get the fully qualified host name.

This function can be expensive performance-wise. It may query multiple DNS servers. If the network is not working correctly, it will fail and throw an exception.

Exceptions
SocketExceptionon failure.

Definition at line 287 of file SocketUtils.cpp.

References BLOCXX_THROW, and BLOCXX_NAMESPACE::gethostbynameMutex.

◆ inetAddrToString()

BLOCXX_COMMON_API String BLOCXX_NAMESPACE::SocketUtils::inetAddrToString ( UInt64 addr)

◆ waitForIO() [1/2]

int BLOCXX_NAMESPACE::SocketUtils::waitForIO ( SocketHandle_t fd,
const Timeout & timeout,
SocketFlags::EWaitDirectionFlag forInput )

◆ waitForIO() [2/2]

int BLOCXX_NAMESPACE::SocketUtils::waitForIO ( SocketHandle_t fd,
int timeOutSecs,
SocketFlags::EWaitDirectionFlag forInput )

Wait for input or output on a socket.

Parameters
fdthe handle of the socket to wait on.
timeOutSecsthe number of seconds to wait.
forInputtrue if we are waiting for input.
Returns
zero if we got input before the timeout expired, -1 on error, and ETIMEDOUT on timeout.

Definition at line 201 of file SocketUtils.cpp.

References BLOCXX_NAMESPACE::Timeout::relative(), and waitForIO().

Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::accept(), BLOCXX_NAMESPACE::PosixUnnamedPipe::passDescriptor(), BLOCXX_NAMESPACE::PosixUnnamedPipe::read(), BLOCXX_NAMESPACE::PosixUnnamedPipe::receiveDescriptor(), BLOCXX_NAMESPACE::SocketBaseImpl::waitForInput(), waitForIO(), BLOCXX_NAMESPACE::SocketBaseImpl::waitForOutput(), and BLOCXX_NAMESPACE::PosixUnnamedPipe::write().