TCP/IP read/write functions. More...
#include "urg_c/urg_ring_buffer.h"#include "urg_c/urg_detect_os.h"#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>

Go to the source code of this file.
Classes | |
| struct | urg_tcpclient_t |
| TCP/IP connection. More... | |
Enumerations | |
| enum | { RB_BITSHIFT = 8, RB_SIZE = 1 << RB_BITSHIFT, BUFSIZE = RB_SIZE - 1 } |
Functions | |
| void | tcpclient_close (urg_tcpclient_t *cli) |
| destructor of tcp client module | |
| int | tcpclient_error (urg_tcpclient_t *cli, char *error_message, int max_size) |
| int | tcpclient_open (urg_tcpclient_t *cli, const char *server_ip_str, int port_num) |
| constructor of tcp client module | |
| int | tcpclient_read (urg_tcpclient_t *cli, char *userbuf, int req_size, int timeout) |
| read from socket. | |
| int | tcpclient_readline (urg_tcpclient_t *cli, char *userbuf, int buf_size, int timeout) |
| read one line from socket. | |
| int | tcpclient_write (urg_tcpclient_t *cli, const char *userbuf, int req_size) |
| write to socket. | |
TCP/IP read/write functions.
Definition in file urg_tcpclient.h.
| anonymous enum |
Definition at line 33 of file urg_tcpclient.h.
| void tcpclient_close | ( | urg_tcpclient_t * | cli | ) |
destructor of tcp client module
| [in,out] | cli | : tcp client type variable which must be deallocated by a caller after closing. |
Definition at line 192 of file urg_tcpclient.c.
| int tcpclient_error | ( | urg_tcpclient_t * | cli, |
| char * | error_message, | ||
| int | max_size | ||
| ) |
Definition at line 280 of file urg_tcpclient.c.
| int tcpclient_open | ( | urg_tcpclient_t * | cli, |
| const char * | server_ip_str, | ||
| int | port_num | ||
| ) |
constructor of tcp client module
| [in,out] | cli | tcp client type variable which must be allocated by a caller. |
| [in] | server_ip_str | IP address expressed in string, i.e. "192.168.0.1" |
| [in] | port_num | port number expressed in integer, i.e. port_num = 10200 |
| 0 | succeeded. |
| -1 | error |
Definition at line 67 of file urg_tcpclient.c.
| int tcpclient_read | ( | urg_tcpclient_t * | cli, |
| char * | userbuf, | ||
| int | req_size, | ||
| int | timeout | ||
| ) |
read from socket.
| [in,out] | cli | : tcp client type variable which must be deallocated by a caller after closing. |
| [out] | userbuf | : buffer to store read data which must be allocated by a caller. |
| [in] | req_size,: | data size requested to read in byte. |
| [in] | timeout | : time out specification which unit is microsecond. |
Definition at line 206 of file urg_tcpclient.c.
| int tcpclient_readline | ( | urg_tcpclient_t * | cli, |
| char * | userbuf, | ||
| int | buf_size, | ||
| int | timeout | ||
| ) |
read one line from socket.
| [in,out] | cli | : tcp client type variable which must be deallocated by a caller after closing. |
| [out] | userbuf | : buffer to store read data which must be allocated by a caller. |
| [in] | buf_size,: | data size requested to read in byte. |
| [in] | timeout | : time out specification which unit is microsecond. |
Definition at line 292 of file urg_tcpclient.c.
| int tcpclient_write | ( | urg_tcpclient_t * | cli, |
| const char * | userbuf, | ||
| int | req_size | ||
| ) |
write to socket.
| [in,out] | cli | : tcp client type variable which must be deallocated by a caller after closing. |
| [in] | userbuf | : data to write. |
| [in] | req_size,: | data size requested to write in byte. |
Definition at line 273 of file urg_tcpclient.c.