|
libsocket
|
Contains libsocket elements. More...
Classes | |
| class | dgram_client_socket |
| Represents a generic "client" datagram socket, i.e. a datagram socket which can be connected. More... | |
| class | dgram_over_stream |
| Wraps a stream socket and provides a message-based API on top of it. More... | |
| class | epollset |
Class abstracting calls to the epoll API of Linux. More... | |
| class | inet_dgram |
| Base class for UDP/IP sockets. More... | |
| class | inet_dgram_client |
Using UDP/IP easy as never before. Class for connectable datagram sockets in the INET domain. You may connect this sockets to permanently associate a peer to which all data is sent and from which all data is received when using the functions defined in class dgram_client_socket More... | |
| class | inet_dgram_server |
| Plain UDP sockets. More... | |
| class | inet_socket |
| Internet-socket base class This class provides some fields for all internet sockets, like remote host and port and the used protocol version. More... | |
| class | inet_stream |
| Provides TCP/IP client sockets. This class is the most used socket class in libsocket++. It provides plain TCP client sockets which can be used for almost everything. More... | |
| class | inet_stream_server |
| TCP server socket (passive TCP socket) More... | |
| class | selectset |
| selectset provides a simple abstraction over – contrary to its name – poll(2). More... | |
| class | socket |
| socket is the base class of every other libsocket++ object. More... | |
| struct | socket_exception |
This class is instantiated and thrown when an error occurs. If there's an error somewhere in libsocket++, the function in which the error occurs /always/ throws a socket_exception object showing why the error occurred. More... | |
| class | stream_client_socket |
| Generic socket for active stream sockets (TCP client sockets, UNIX Stream clients) More... | |
| class | unix_dgram |
| Generic class for all UNIX datagram (DGRAM) sockets, implementing i/o functions. More... | |
| class | unix_dgram_client |
| Class for UNIX datagram sockets. More... | |
| class | unix_dgram_server |
| Provides an interface to UNIX-domain datagram sockets. More... | |
| class | unix_socket |
| Base class for all UNIX socket classes. More... | |
| class | unix_stream_client |
| Provides an interface for working with UNIX STREAM sockets. More... | |
| class | unix_stream_server |
| Socket class for UNIX-domain STREAM socket server. More... | |
Functions | |
| void | encode_uint32 (uint32_t n, char *dst) |
| uint32_t | decode_uint32 (const char *src) |
| int | highestfd (const std::vector< int > &v) |
| Utility function to find the highest number in a vector (typically, the highest file descriptor) More... | |
| dgram_client_socket & | operator>> (dgram_client_socket &sock, string &dest) |
| Receive data from connected datagram socket. More... | |
| dgram_client_socket & | operator<< (dgram_client_socket &sock, const char *str) |
| Send data to connected peer. More... | |
| dgram_client_socket & | operator<< (dgram_client_socket &sock, const string &str) |
| Send data to connected peer. More... | |
| stream_client_socket & | operator>> (stream_client_socket &sock, string &dest) |
| Receive data from socket to a string. More... | |
| stream_client_socket & | operator<< (stream_client_socket &sock, const char *str) |
| Send data to socket. More... | |
| stream_client_socket & | operator<< (stream_client_socket &sock, const string &str) |
| Send data to socket. More... | |
Variables | |
| const size_t | FRAMING_PREFIX_LENGTH = 4 |
Contains libsocket elements.
All libsocket classes etc are defined within the namespace "libsocket".
| int libsocket::highestfd | ( | const std::vector< int > & | v | ) |
Utility function to find the highest number in a vector (typically, the highest file descriptor)
Definition at line 42 of file select.cpp.
| dgram_client_socket& libsocket::operator>> | ( | dgram_client_socket & | sock, |
| string & | dest | ||
| ) |
Receive data from connected datagram socket.
If a datagram socket is connected, you may receive data from it using stream-like functions.
| sock | The socket to receive data from |
| dest | The string to write data to. This string has to be resized to the number of bytes you wish to receive. |
Definition at line 95 of file dgramclient.cpp.
| dgram_client_socket& libsocket::operator<< | ( | dgram_client_socket & | sock, |
| const char * | str | ||
| ) |
Send data to connected peer.
Usage: socket << "Abcde";
Definition at line 155 of file dgramclient.cpp.
| dgram_client_socket& libsocket::operator<< | ( | dgram_client_socket & | sock, |
| const string & | str | ||
| ) |
Send data to connected peer.
Usage: socket << "Abcde";
Definition at line 180 of file dgramclient.cpp.
| stream_client_socket& libsocket::operator>> | ( | stream_client_socket & | sock, |
| string & | dest | ||
| ) |
Receive data from socket to a string.
Receives n bytes of data (where n == dest.size()) and writes it to a string.
Application: infix; sock >> dest1 [>> dest2...];
| sock | the socket. |
| dest | the destination string. Its length determines how much data is received. |
The dest string is resized to 0 if the socket is non-blocking and no data could be received.
Definition at line 118 of file streamclient.cpp.
| stream_client_socket& libsocket::operator<< | ( | stream_client_socket & | sock, |
| const char * | str | ||
| ) |
Send data to socket.
Sends data to socket using stream-like syntax:
socket << "Hello " << "World" << "\n";
Important: Only overloaded for C and C++ strings, not for numbers, chars etc.!
| sock | A socket. |
| str | Data to be sent; do a static_cast<>() to send raw data. |
Definition at line 174 of file streamclient.cpp.
| stream_client_socket& libsocket::operator<< | ( | stream_client_socket & | sock, |
| const string & | str | ||
| ) |
Send data to socket.
Sends data to socket using stream-like syntax:
socket << "Hello " << "World" << "\n";
Important: Only overloaded for C and C++ strings, not for numbers, chars etc.!
| sock | A socket. |
| str | Data. |
Definition at line 212 of file streamclient.cpp.
1.8.15