ENUt
Public Member Functions | Protected Member Functions

nut::Socket Class Reference

Base class for sockets. More...

#include <socket.h>

Inheritance diagram for nut::Socket:
Inheritance graph
[legend]

List of all members.

Public Member Functions

bool setSocketOption (int level, int optname, const void *optval, socklen_t optlen)
 Sets a specific socket option.
bool getSocketOption (int level, int optname, void *optval, socklen_t *optlen)
 Retrieves a specific socket option.
bool waitForData (int seconds=-1, int microSeconds=-1)
 Wait for incoming data or for an incoming connection request.
bool isDataAvailable () const
 When the socket was used by a SocketWaiter instance, this flag indicates if data is available after the SocketWaiter::wait function was called (this function is not used in a socket's getAvailableDataLength function).

Protected Member Functions

 Socket ()
 Creates an unnamed socket.
 Socket (const std::string &objName)
 Creates a socket with object name objName.

Detailed Description


Constructor & Destructor Documentation

nut::Socket::Socket ( ) [inline, protected]
nut::Socket::Socket ( const std::string &  objName) [inline, protected]

Member Function Documentation

bool nut::Socket::getSocketOption ( int  level,
int  optname,
void *  optval,
socklen_t *  optlen 
)

Retrieves a specific socket option. This function is basically a wrapper for the getsockopt function.

bool nut::Socket::setSocketOption ( int  level,
int  optname,
const void *  optval,
socklen_t  optlen 
)

Sets a specific socket option. This function is basically a wrapper for the setsockopt function.

bool nut::Socket::waitForData ( int  seconds = -1,
int  microSeconds = -1 
)

Wait for incoming data or for an incoming connection request. The maximum time to wait is specified by seconds and microSeconds. This function is equivalent with using a SocketWaiter instance, adding this socket and calling the SocketWaiter::wait function. As a result, the isDataAvailable function can be used after calling this function.


The documentation for this class was generated from the following file: