libsent/src/net/server-client.c File Reference

Server client connection. More...

#include <sent/stddefs.h>
#include <sent/tcpip.h>

Go to the source code of this file.

Functions

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.


Detailed Description

Server client connection.

Author:
Akinobu LEE
Date:
Wed Feb 16 07:18:13 2005
Revision
1.1.1.1

Definition in file server-client.c.


Function Documentation

int ready_as_server ( int  port_num  ) 

Prepare as a server creating a socket for client connection.

Parameters:
port_num [in] network port to listen.
Returns:
socket descriptor, or -1 if failed to create socket, -2 if failed to bind, or -3 if failed to listen.

Definition at line 41 of file server-client.c.

Referenced by adin_tcpip_standby().

int accept_from ( int  sd  ) 

Wait for a request from client.

This function blocks until a connection request comes.

Parameters:
sd [in] listening server socket descpritor
Returns:
the connected socket descriptor.

Definition at line 120 of file server-client.c.

Referenced by adin_tcpip_begin().

int make_connection ( char *  hostname,
int  port_num 
)

Make a connection to a server.

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

Definition at line 164 of file server-client.c.

int make_connection_unix ( char *  address  ) 

Make a connection to a server using unix domain socket.

Parameters:
address [in] unix domain socket address (path)
Returns:
new socket descriptor, -1 if fails to prepare socket, -2 if fails to connect.

Definition at line 247 of file server-client.c.

int close_socket ( int  sd  ) 

Close socket.

Parameters:
sd [in] socket descriptor to close
Returns:
0 on success, -1 on failure.

Definition at line 282 of file server-client.c.

Referenced by adin_tcpip_end().


Generated on Tue Dec 18 16:01:40 2007 for Julius by  doxygen 1.5.4