
socket_create(3)      LPC Library Functions      socket_create(3)

NNAAMMEE
       socket_create() - create an efun socket

SSYYNNOOPPSSIISS
       #include <socket_err.h>

       int socket_create( int mode, string read_callback,
                          void | string close_callback );

DDEESSCCRRIIPPTTIIOONN
       socket_create()  creates  an  efun socket. mode determines
       which type  of  socket  is  created.  Currently  supported
       socket modes are:

       MUD         for sending LPC data types using TCP protocol.

       STREAM      for sending raw data using TCP protocol.

       DATAGRAM    for using UDP protocol.

       The argument read_callback is the name of a  function  for
       the  driver  to  call  when  the socket gets data from its
       peer. The read callback should follow this format:

              void read_callback(int fd, mixed message)

       Where fd is the socket which received the data,  and  mes       sage is the data which was received.

       The  argument close_callback is the name of a function for
       the driver to call if the socket closes unexpectedly, i.e.
       not  as  the  result  of a socket_close(3) call. The close
       callback should follow this format:

              void close_callback(int fd)

       Where  fd  is  the  socket  which   has   closed.    NOTE:
       close_callback is not used with DATAGRAM mode sockets.

RREETTUURRNN VVAALLUUEESS
       socket_create() returns:

              a non-negative descriptor on success.

              a negative value indicated below on error.

EERRRROORRSS
       EEMODENOTSUPP  Socket mode not supported.

       EESOCKET       Problem creating socket.

Majik                      26 Jul 1997                          1

socket_create(3)      LPC Library Functions      socket_create(3)

       EESETSOCKOPT   Problem with setsockopt.

       EENONBLOCK     Problem setting non-blocking mode.

       EENOSOCKS      No more available efun sockets.

       EESECURITY     Security violation attempted.

SSEEEE AALLSSOO
       socket_accept(3),     socket_bind(3),     socket_close(3),
       socket_connect(3), socket_listen(3), socket_write(3)

Majik                      26 Jul 1997                          2

