Main Page | Modules | Data Structures | File List | Data Fields

Networking


Defines

#define u_net_write(sd, buf, nbytes, nw, iseof)   u_io((iof_t) write, sd, buf, nbytes, nw, iseof)
 u_io specialisation for output ops


Functions

int u_net_sock (const char *uri, int mode)
 Top level socket creation routine.


Function Documentation

int u_net_sock const char *  uri,
int  mode
 

This routine creates a socket and returns its file descriptor. A client socket (U_NET_CSOCK) is identified by its connection endpoint, a server socket (U_NET_SSOCK) by its local address.

The identification is done via a family of private URIs:

  • {tc,ud}p[46]://<host>:<port> for TCP/UDP over IPv[46] addresses,
  • unix://<abs_path> for UNIX IPC pathnames.

After resolving the supplied URI, the control is passed to the appropriate handler which carries out the real job (i.e. connect(2) or bind(2)). Per-protocol handlers can be used in combination with the URI resolver and translation functions for greater flexibility.

See also:
u_net_tcp4_ssock, u_net_tcp6_ssock, u_net_tcp4_csock, u_net_tcp6_csock, u_net_uri2addr, u_net_uri2sin, u_net_uri2sun.
Parameters:
uri the URI at which the socket shall be connected/bounded
mode U_NET_SSOCK for server sockets, U_NET_CSOCK for clients.
Returns:
  • the socket descriptor on success
  • -1 on failure

Definition at line 55 of file net.c.


←Products
© 2005-2008 - KoanLogic S.r.l. - All rights reserved