#include <yateclass.h>
Inheritance diagram for Socket:
Public Types | |
enum | TOS { LowDelay = IPTOS_LOWDELAY, MaxThroughput = IPTOS_THROUGHPUT, MaxReliability = IPTOS_RELIABILITY, MinCost = IPTOS_MINCOST } |
Public Member Functions | |
Socket () | |
Socket (SOCKET handle) | |
Socket (int domain, int type, int protocol=0) | |
virtual | ~Socket () |
bool | create (int domain, int type, int protocol=0) |
virtual bool | terminate () |
void | attach (SOCKET handle) |
SOCKET | detach () |
SOCKET | handle () const |
virtual bool | canRetry () const |
virtual bool | valid () const |
bool | setOption (int level, int name, const void *value=0, socklen_t length=0) |
bool | getOption (int level, int name, void *buffer, socklen_t *length) |
bool | setTOS (int tos) |
virtual bool | setBlocking (bool block=true) |
bool | setReuse (bool reuse=true, bool exclusive=false) |
bool | setLinger (int seconds=-1) |
bool | bind (struct sockaddr *addr, socklen_t addrlen) |
bool | bind (const SocketAddr &addr) |
bool | listen (unsigned int backlog=0) |
Socket * | accept (struct sockaddr *addr=0, socklen_t *addrlen=0) |
Socket * | accept (SocketAddr &addr) |
SOCKET | acceptHandle (struct sockaddr *addr=0, socklen_t *addrlen=0) |
Socket * | peelOff (unsigned int assoc) |
SOCKET | peelOffHandle (unsigned int assoc) |
bool | connect (struct sockaddr *addr, socklen_t addrlen) |
bool | connect (const SocketAddr &addr) |
bool | shutdown (bool stopReads, bool stopWrites) |
bool | getSockName (struct sockaddr *addr, socklen_t *addrlen) |
bool | getSockName (SocketAddr &addr) |
bool | getPeerName (struct sockaddr *addr, socklen_t *addrlen) |
bool | getPeerName (SocketAddr &addr) |
int | sendTo (const void *buffer, int length, const struct sockaddr *addr, socklen_t adrlen, int flags=0) |
int | sendTo (const void *buffer, int length, const SocketAddr &addr, int flags=0) |
int | send (const void *buffer, int length, int flags=0) |
virtual int | writeData (const void *buffer, int length) |
int | recvFrom (void *buffer, int length, struct sockaddr *addr=0, socklen_t *adrlen=0, int flags=0) |
int | recvFrom (void *buffer, int length, SocketAddr &addr, int flags=0) |
int | recv (void *buffer, int length, int flags=0) |
virtual int | readData (void *buffer, int length) |
bool | select (bool *readok, bool *writeok, bool *except, struct timeval *timeout=0) |
bool | select (bool *readok, bool *writeok, bool *except, int64_t timeout) |
Static Public Member Functions | |
static SOCKET | invalidHandle () |
static int | socketError () |
static bool | createPair (Socket &sock1, Socket &sock2, int domain=AF_UNIX) |
Protected Member Functions | |
void | copyError () |
bool | checkError (int retcode, bool strict=false) |
Protected Attributes | |
SOCKET | m_handle |
This class encapsulates a system dependent socket in a system independent abstraction
|
Types of service |
|
Default constructor, creates an invalid socket |
|
Constructor from an existing handle
|
|
Constructor that also creates the socket handle
|
|
Destructor - closes the handle if still open |
|
Create a new socket for an incoming connection attempt on a listening socket
|
|
Create a new socket for an incoming connection attempt on a listening socket
|
|
Create a new socket for an incoming connection attempt on a listening socket
|
|
Attach an existing handle to the socket, closes any existing first
|
|
Associates the socket with a local address
|
|
Associates the socket with a local address
|
|
Check if the last error code indicates a retryable condition
Reimplemented from Stream. |
|
Copy the last error code from the operating system if an error occured, clear if not
|
|
Connects the socket to a remote address
|
|
Connects the socket to a remote address
|
|
Copy the last error code from the operating system |
|
Creates a new socket handle,
|
|
Create a pair of bidirectionally connected sockets
|
|
Detaches the object from the socket handle
|
|
Get socket options
|
|
Retrive the address of the remote socket of a connection
|
|
Retrive the address of the remote socket of a connection
|
|
Retrive the address of the local socket of a connection
|
|
Retrive the address of the local socket of a connection
|
|
Get the operating system handle to the socket
|
|
Get the operating system specific handle value for an invalid socket
|
|
Start listening for incoming connections on the socket
|
|
Create a new socket by peeling off an association from a SCTP socket
|
|
Create a new socket by peeling off an association from a SCTP socket
|
|
Receive data from a connected stream socket
Implements Stream. |
|
Receive a message from a connected socket
|
|
Receive a message from a connected or unconnected socket
|
|
Receive a message from a connected or unconnected socket
|
|
Determines the availability to perform synchronous I/O of the socket
|
|
Determines the availability to perform synchronous I/O of the socket
|
|
Send a message over a connected socket
|
|
Send a message over a connected or unconnected socket
|
|
Send a message over a connected or unconnected socket
|
|
Set the blocking or non-blocking operation mode of the socket
Reimplemented from Stream. |
|
Set the way closing a socket is handled
|
|
Set socket options
|
|
Set the local address+port reuse flag of the socket. This method should be called before bind() or it will have no effect.
|
|
Set the Type of Service on the IP level of this socket
|
|
Shut down one or both directions of a full-duplex socket.
|
|
Get the operating system specific return value of a failed operation
|
|
Closes the socket handle, terminates the connection
Implements Stream. |
|
Check if this socket is valid
Implements Stream. |
|
Write data to a connected stream socket
Implements Stream. |