Enumerations | Functions
urg_tcpclient.c File Reference

TCP/IP read/write functions. More...

#include "urg_c/urg_detect_os.h"
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include "urg_c/urg_tcpclient.h"
#include <stdio.h>
Include dependency graph for urg_tcpclient.c:

Go to the source code of this file.

Enumerations

enum  { Invalid_desc = -1 }

Functions

static void set_block_mode (urg_tcpclient_t *cli)
static int tcpclient_buffer_data_num (urg_tcpclient_t *cli)
static void tcpclient_buffer_init (urg_tcpclient_t *cli)
static int tcpclient_buffer_read (urg_tcpclient_t *cli, char *data, int size)
static int tcpclient_buffer_write (urg_tcpclient_t *cli, const char *data, int size)
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 *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 *buf, int size)
 write to socket.

Detailed Description

TCP/IP read/write functions.

Author:
Katsumi Kimoto
Id:
urg_tcpclient.c,v d746d6f9127d 2011/05/08 23:10:44 satofumi

Definition in file urg_tcpclient.c.


Enumeration Type Documentation

anonymous enum
Enumerator:
Invalid_desc 

Definition at line 24 of file urg_tcpclient.c.


Function Documentation

static void set_block_mode ( urg_tcpclient_t cli) [static]

Definition at line 55 of file urg_tcpclient.c.

static int tcpclient_buffer_data_num ( urg_tcpclient_t cli) [static]

Definition at line 36 of file urg_tcpclient.c.

static void tcpclient_buffer_init ( urg_tcpclient_t cli) [static]

Definition at line 29 of file urg_tcpclient.c.

static int tcpclient_buffer_read ( urg_tcpclient_t cli,
char *  data,
int  size 
) [static]

Definition at line 49 of file urg_tcpclient.c.

static int tcpclient_buffer_write ( urg_tcpclient_t cli,
const char *  data,
int  size 
) [static]

Definition at line 42 of file urg_tcpclient.c.

destructor of tcp client module

Parameters:
[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 
)
Attention:
not implemented yet.

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

Parameters:
[in,out]clitcp client type variable which must be allocated by a caller.
[in]server_ip_strIP address expressed in string, i.e. "192.168.0.1"
[in]port_numport number expressed in integer, i.e. port_num = 10200
Return values:
0succeeded.
-1error

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.

Parameters:
[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.
Returns:
the number of data read, -1 when error.

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.

Parameters:
[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.
Returns:
the number of data read, -1 when error.

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.

Parameters:
[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.
Returns:
returns the number of data wrote, -1 when error.

Definition at line 273 of file urg_tcpclient.c.



urg_c
Author(s): Satofumi Kamimura , Katsumi Kimoto, Adrian Boeing
autogenerated on Thu Jun 6 2019 19:06:57