definitions for client socket abstraction api More...
#include "common.h"
#include "config.h"
#include "hashlist.h"
#include "vector.h"
#include "thread.h"
#include "socket.h"
Go to the source code of this file.
Data Structures | |
struct | _cp_client |
cp_client is a 'client socket'. More... | |
Defines | |
#define | DEFAULT_CLIENT_TIMEOUT 300 |
seconds to wait for responses | |
#define | DEFAULT_RETRIES 3 |
default connect retries | |
Typedefs | |
typedef CPROPS_DLL struct _cp_client | cp_client |
cp_client is a 'client socket'. | |
Functions | |
CPROPS_DLL void | cp_client_init () |
recommended to call before using tcp client socket functions | |
CPROPS_DLL void | cp_client_stop_all () |
call from signal handler to stop sockets in waiting select() and close all connections | |
CPROPS_DLL void | cp_client_shutdown () |
performs cleanup | |
CPROPS_DLL void | cp_tcp_add_shutdown_callback (void(*cb)(void *), void *prm) |
add callback to be made on tcp layer shutdown | |
CPROPS_DLL cp_client * | cp_client_create (char *host, int port) |
create a client socket | |
CPROPS_DLL cp_client * | cp_client_create_addr (struct sockaddr_in *) |
create a client socket with a struct sockaddr * | |
CPROPS_DLL void | cp_client_set_timeout (cp_client *client, int sec, int usec) |
set the timeout - (0, 0) for no timeout | |
CPROPS_DLL void | cp_client_set_retry (cp_client *client, int retry_count) |
number of connection retries | |
CPROPS_DLL void | cp_client_set_owner (cp_client *client, void *owner) |
useful free pointer for client code | |
CPROPS_DLL int | cp_client_connect (cp_client *client) |
opens a connection. | |
CPROPS_DLL int | cp_client_reopen (cp_client *client, char *host, int port) |
use the same wrapper for a different address. | |
CPROPS_DLL int | cp_client_close (cp_client *client) |
close a client connection | |
CPROPS_DLL void | cp_client_destroy (cp_client *client) |
deallocate a cp_client | |
CPROPS_DLL int | cp_client_read (cp_client *client, char *buf, int len) |
CPROPS_DLL int | cp_client_read_string (cp_client *client, cp_string *str, int len) |
CPROPS_DLL int | cp_client_write (cp_client *client, char *buf, int len) |
CPROPS_DLL int | cp_client_write_string (cp_client *client, cp_string *str) |
definitions for client socket abstraction api