全て データ構造 ファイル 関数 変数 型定義 列挙型 列挙型の値 マクロ定義
データ構造 | 列挙型 | 関数
include/c/urg_tcpclient.h

TCP/IP read/write functions. [詳細]

#include "urg_ring_buffer.h"
#include "urg_detect_os.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

ソースコードを見る。

データ構造

struct  urg_tcpclient_t
 TCP/IP connection. [詳細]

列挙型

enum  { RB_BITSHIFT = 8, RB_SIZE = 1 << RB_BITSHIFT, BUFSIZE = RB_SIZE - 1 }

関数

int tcpclient_open (urg_tcpclient_t *cli, const char *server_ip_str, int port_num)
 constructor of tcp client module
void tcpclient_close (urg_tcpclient_t *cli)
 destructor of tcp client module
int tcpclient_read (urg_tcpclient_t *cli, char *userbuf, int req_size, int timeout)
 read from socket.
int tcpclient_write (urg_tcpclient_t *cli, const char *userbuf, int req_size)
 write to socket.
int tcpclient_error (urg_tcpclient_t *cli, char *error_message, int max_size)
int tcpclient_readline (urg_tcpclient_t *cli, char *userbuf, int buf_size, int timeout)
 read one line from socket.

説明

TCP/IP read/write functions.

作者:
Katsumi Kimoto
Id:
urg_tcpclient.h,v 1d233c7a2240 2011/02/19 03:08:45 Satofumi

関数

destructor of tcp client module

引数:
[in,out]cli: tcp client type variable which must be deallocated by a caller after closing.
int tcpclient_error ( urg_tcpclient_t cli,
char *  error_message,
int  max_size 
)
注意:
not implemented yet.
int tcpclient_open ( urg_tcpclient_t cli,
const char *  server_ip_str,
int  port_num 
)

constructor of tcp client module

引数:
[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
戻り値:
0succeeded.
-1error
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.
戻り値:
the number of data read, -1 when error.
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.
戻り値:
the number of data read, -1 when error.
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.
戻り値:
returns the number of data wrote, -1 when error.