/
MudOS_0.9.19/bin/
MudOS_0.9.19/doc/concepts/
MudOS_0.9.19/doc/driver/
MudOS_0.9.19/doc/efuns/bitstrings/
MudOS_0.9.19/doc/efuns/buffers/
MudOS_0.9.19/doc/efuns/communication/
MudOS_0.9.19/doc/efuns/core/
MudOS_0.9.19/doc/efuns/mappings/
MudOS_0.9.19/doc/efuns/math/
MudOS_0.9.19/doc/efuns/security/
MudOS_0.9.19/doc/lpc/constructs/
MudOS_0.9.19/doc/lpc/types/
MudOS_0.9.19/doc/platforms/
MudOS_0.9.19/etc/
MudOS_0.9.19/mudlib/
MudOS_0.9.19/mudlib/lil/
MudOS_0.9.19/mudlib/lil/clone/
MudOS_0.9.19/mudlib/lil/command/
MudOS_0.9.19/mudlib/lil/data/
MudOS_0.9.19/mudlib/lil/etc/
MudOS_0.9.19/mudlib/lil/include/
MudOS_0.9.19/mudlib/lil/inherit/
MudOS_0.9.19/mudlib/lil/inherit/master/
MudOS_0.9.19/mudlib/lil/log/
MudOS_0.9.19/mudlib/lil/single/
MudOS_0.9.19/mudlib/lil/u/
MudOS_0.9.19/src/testsuite/
MudOS_0.9.19/src/testsuite/clone/
MudOS_0.9.19/src/testsuite/command/
MudOS_0.9.19/src/testsuite/data/
MudOS_0.9.19/src/testsuite/etc/
MudOS_0.9.19/src/testsuite/include/
MudOS_0.9.19/src/testsuite/inherit/
MudOS_0.9.19/src/testsuite/inherit/master/
MudOS_0.9.19/src/testsuite/log/
MudOS_0.9.19/src/testsuite/single/
MudOS_0.9.19/src/testsuite/single/efuns/
MudOS_0.9.19/src/testsuite/u/
.\"create an efun socket
.TH socket_create 3

.SH NAME
socket_create() - create an efun socket

.SH SYNOPSIS
.nf
#include <socket.h>
#include <socket_errors.h>

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

.SH DESCRIPTION
socket_create() creates an efun socket. mode determines which type of
socket is created. Currently supported socket modes are:
.TP 12
MUD
for sending LPC data types using TCP protocol.
.TP
STREAM
for sending raw data using TCP protocol.
.TP
DATAGRAM
for using UDP protocol.
.PP
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:
.IP
void read_callback(int fd, mixed message)
.PP
Where fd is the socket which received the data, and message is the data
which was received.
.PP
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:
.IP
void close_callback(int fd)
.PP
Where fd is the socket which has closed.
NOTE: close_callback is not used with DATAGRAM mode sockets.

.SH RETURN VALUES
socket_create() returns:
.IP
a non-negative descriptor on success.
.IP
a negative value indicated below on error.

.SH ERRORS
.TP 15
EEMODENOTSUPP
Socket mode not supported.
.TP
EESOCKET
Problem creating socket.
.TP
EESETSOCKOPT
Problem with setsockopt.
.TP
EENONBLOCK
Problem setting non-blocking mode.
.TP
EENOSOCKS
No more available efun sockets.
.TP
EESECURITY
Security violation attempted.
.SH SEE ALSO
socket_accept(3), socket_bind(3), socket_close(3), socket_connect(3),
socket_listen(3), socket_write(3)
socket_listen(3), socket_write(3)