Julius 4.2
マクロ定義 | 関数
libsent/include/sent/tcpip.h

TCP/IP ネットワーク関連の定義 [詳細]

#include <errno.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <arpa/inet.h>
#include <sys/file.h>
#include <sys/types.h>
#include <fcntl.h>

ソースコードを見る。

マクロ定義

#define ADINNET_PORT   5530
 Default port number of A/D-in server (adinnet)
#define NETAUDIO_DEVNAME   "localhost:0"
 Default Host/unit name for NetAudio/DatLink input.
#define CONNECTION_RETRY_TIMES   5
 Retry time when client connection failed */.
#define CONNECTION_RETRY_INTERVAL   2
 Interval time between retry in seconds.

関数

int rd (int fd, char *data, int *len, int maxlen)
 Read a data segment from a network stream.
int wt (int fd, char *data, int len)
 Write a data segment to a network stream.
int ready_as_server (int port_num)
 Prepare as a server creating a socket for client connection.
int accept_from (int sd)
 Wait for a request from client.
int make_connection (char *hostname, int port_num)
 Make a connection to a server.
int make_connection_unix (char *address)
 Make a connection to a server using unix domain socket.
int close_socket (int sd)
 Close socket.
void cleanup_socket ()
 Clean up socket data at program exit.

説明

TCP/IP ネットワーク関連の定義

作者:
Akinobu LEE
日付:
Sat Feb 12 12:26:15 2005
Revision:
1.4

tcpip.h で定義されています。


関数

int rd ( int  fd,
char *  data,
int *  len,
int  maxlen 
)

Read a data segment from a network stream.

This function will block until the specified length has been received.

引数:
fd[in] file descriptor
data[out] buffer to store the read data
len[out] received length in bytes
maxlen[in] maximum length of data buffer in bytes
戻り値:
received data length in bytes, or -1 on error.

rdwt.c44 行で定義されています。

参照元 adin_tcpip_read(), と adin_tcpip_send_resume().

int wt ( int  fd,
char *  data,
int  len 
)

Write a data segment to a network stream.

引数:
fd[in] file descriptor
data[in] buffer that holds data to write
len[out] received length in bytes
戻り値:
actually written data length in bytes, or -1 on error.

rdwt.c97 行で定義されています。

参照元 adin_tcpip_send_pause(), adin_tcpip_send_resume(), と adin_tcpip_send_terminate().

int ready_as_server ( int  port_num)

Prepare as a server creating a socket for client connection.

引数:
port_num[in] network port to listen.
戻り値:
socket descriptor, or -1 if failed to create socket, -2 if failed to bind, or -3 if failed to listen.

server-client.c41 行で定義されています。

参照元 adin_tcpip_standby().

int accept_from ( int  sd)

Wait for a request from client.

This function blocks until a connection request comes.

引数:
sd[in] listening server socket descpritor
戻り値:
the connected socket descriptor.

server-client.c120 行で定義されています。

参照元 adin_tcpip_begin().

int make_connection ( char *  hostname,
int  port_num 
)

Make a connection to a server.

引数:
hostname[in] server host (host name or numeric IP address)
port_num[in] port number
戻り値:
new socket descriptor, -1 if fails to prepare socket, -2 if fails to connect, -3 if host name is wrong.

server-client.c165 行で定義されています。

int make_connection_unix ( char *  address)

Make a connection to a server using unix domain socket.

引数:
address[in] unix domain socket address (path)
戻り値:
new socket descriptor, -1 if fails to prepare socket, -2 if fails to connect.

server-client.c248 行で定義されています。

int close_socket ( int  sd)

Close socket.

引数:
sd[in] socket descriptor to close
戻り値:
0 on success, -1 on failure.

server-client.c283 行で定義されています。

参照元 adin_tcpip_end().