bufferevent_socket_new()
EVENT2_EXPORT_SYMBOL struct bufferevent* bufferevent_socket_new | ( | struct event_base * | base, |
evutil_socket_t | fd, | ||
int | options | ||
) |
Create a new socket bufferevent over an existing socket.
Parameters
base | the event base to associate with the new bufferevent. |
fd | the file descriptor from which data is read and written to. This file descriptor is not allowed to be a pipe(2). It is safe to set the fd to -1, so long as you later set it with bufferevent_setfd or bufferevent_socket_connect(). |
options | Zero or more BEV_OPT_* flags |
Returns
a pointer to a newly allocated bufferevent struct, or NULL if an error occurred
See also
evhttp_connection_base_bufferevent_new()
EVENT2_EXPORT_SYMBOL struct evhttp_connection* evhttp_connection_base_bufferevent_new | ( | struct event_base * | base, |
struct evdns_base * | dnsbase, | ||
struct bufferevent * | bev, | ||
const char * | address, | ||
ev_uint16_t | port | ||
) |
Create and return a connection object that can be used to for making HTTP requests.
The connection object tries to resolve address and establish the connection when it is given an http request object.
Connection also has default timeouts for the following events:
- connect HTTP_CONNECT_TIMEOUT, which is 45 seconds
- read HTTP_READ_TIMEOUT which is 50 seconds
- write HTTP_WRITE_TIMEOUT, which is 50 seconds
Parameters
base | the event_base to use for handling the connection |
dnsbase | the dns_base to use for resolving host names; if not specified host name resolution will block. |
bev | a bufferevent to use for connecting to the server; if NULL, a socket-based bufferevent will be created. This bufferevent will be freed when the connection closes. It must have no fd set on it. |
address | the address to which to connect |
port | the port to connect to |
Returns
an evhttp_connection object that can be used for making requests or NULL on error