![]() |
C library for SOAP (Simple Object Access Protocol) |
Modules | |
| Generic socket errors | |
Data Structures | |
| struct | hsocket_t |
Functions | |
| herror_t | hsocket_module_init (int argc, char **argv) |
| void | hsocket_module_destroy (void) |
| herror_t | hsocket_init (struct hsocket_t *sock) |
| void | hsocket_free (struct hsocket_t *sock) |
| herror_t | hsocket_open (struct hsocket_t *sock, const char *host, int port, int ssl) |
| void | hsocket_close (struct hsocket_t *sock) |
| herror_t | hsocket_bind (struct hsocket_t *sock, unsigned short port) |
| herror_t | hsocket_listen (struct hsocket_t *sock) |
| herror_t | hsocket_accept (struct hsocket_t *sock, struct hsocket_t *dest) |
| herror_t | hsocket_send (struct hsocket_t *sock, const unsigned char *bytes, int size) |
| herror_t | hsocket_send_string (struct hsocket_t *sock, const char *str) |
| int | hsocket_select_recv (int sock, char *buf, size_t len) |
| herror_t | hsocket_recv (struct hsocket_t *sock, unsigned char *buffer, int size, int force, int *len) |
| int | hsocket_get_timeout (void) |
| void | hsocket_set_timeout (int secs) |
This function accepts an incoming socket request. Note that this function will not return until a socket connection is ready.
| sock | the socket which listents to a port | |
| dest | the destination socket which will be created |
This function binds a socket to a given port number. After bind you can call hsocket_listen() to listen to the port.
| sock | socket to use. | |
| port | port number to bind to |
| void hsocket_close | ( | struct hsocket_t * | sock | ) |
This function closes a socket connection.
| sock | the socket to close |
| void hsocket_free | ( | struct hsocket_t * | sock | ) |
This function destroys and releases a given socket.
| sock | the socket to destroy |
| int hsocket_get_timeout | ( | void | ) |
This function gets the socket read/write timeout.
This function initializes a given socket object. This function (or hsokcet_init_ssl) should be called for every socket before using it.
| sock | the destination socket to initialize. |
This function sets the socket to the listen mode. You must bind the socket to a port with hsocket_bind() before you can listen to the port.
| sock | the socket to use |
| void hsocket_module_destroy | ( | void | ) |
This function destroys the socket modul. This should be called after finishing an application.
| herror_t hsocket_module_init | ( | int | argc, | |
| char ** | argv | |||
| ) |
This function iitializes the socket modul. This should be called only once for an application.
This function connects to a given host. The hostname can be an IP number or a humen readable hostname.
| sock | the destonation socket object to use | |
| host | hostname | |
| port | port number to connect to | |
| ssl | whether to open a SSL connection |
| herror_t hsocket_recv | ( | struct hsocket_t * | sock, | |
| unsigned char * | buffer, | |||
| int | size, | |||
| int | force, | |||
| int * | len | |||
| ) |
This function reads data from the socket.
| sock | the socket to read data from | |
| buffer | the buffer to use to save the readed bytes | |
| size | the maximum size of bytes to read | |
| force | if force is 1 then hsocket_read() will wait until maximum size of bytes (size parameter) was readed. Otherwise this function will not wait and will return with the bytes quequed on the socket. |
| int hsocket_select_recv | ( | int | sock, | |
| char * | buf, | |||
| size_t | len | |||
| ) |
This function sends data throught the socket.
| sock | the socket to use to send the data | |
| bytes | bytes to send | |
| size | size of memory to sent pointed by bytes. |
This function sends a string throught the socket
| sock | the socket to use to send the data | |
| str | the null terminated string to sent |
| void hsocket_set_timeout | ( | int | secs | ) |
This function sets the socket read/write timeout.
| secs | Timeout in seconds. |