Provides a buffered socket that reconnects on errors. More...
#include "qev.h"Go to the source code of this file.
Typedefs | |
| typedef struct qev_rsock | qev_rsock_t |
| No need to worry, just a flesh wound. | |
Functions | |
| qev_rsock_t * | qev_rsock_new (const gchar *addr, const guint16 port) |
| Create a new reconnecting socket. More... | |
| void | qev_rsock_free (qev_rsock_t *rsock) |
| Destroy the socket. | |
| void | qev_rsock_send (qev_rsock_t *rsock, const gchar *data, const gsize len) |
| Send data over the socket. More... | |
| gsize | qev_rsock_recv (qev_rsock_t *rsock, gchar *buff, const gsize len) |
| Receive data from the socket. More... | |
Provides a buffered socket that reconnects on errors.
This is typically useful for blind-writing data to a socket where it's not mission critical that the data make it through (such as stats).
| qev_rsock_t* qev_rsock_new | ( | const gchar * | addr, |
| const guint16 | port | ||
| ) |
Create a new reconnecting socket.
The userspace buffer of this socket is limited by the userspace watermarks just like any other socket.
| addr | The address to connect to |
| port | The port to connect to |
| gsize qev_rsock_recv | ( | qev_rsock_t * | rsock, |
| gchar * | buff, | ||
| const gsize | len | ||
| ) |
Receive data from the socket.
Will not block, and will only return data that is available.
| rsock | The socket to send data on |
| buff | Where to put read data |
| len | The length of buff |
| void qev_rsock_send | ( | qev_rsock_t * | rsock, |
| const gchar * | data, | ||
| const gsize | len | ||
| ) |
Send data over the socket.
If data backs up into user space, it will be flushed on the next call. No background operations will take place.
| rsock | The socket to send data on |
| data | The data to send |
| len | The length of the data |
1.8.6