socket_create() creates an efun socket. mode determines which type of
socket is created. Currently supported socket modes are:
0 MUD for sending LPC data types using TCP protocol.
1 STREAM for sending raw data using TCP protocol.
2 DATAGRAM for using UDP protocol.
3 STREAM_BINARY for exchange binary message with TCP protocol.
4 DATAGRAM_BINARY for exchange binary message with UDP protocol.
5 STREAM_TLS for sending raw data using TLS/SSL over TCP protocol.
6 STREAM_TLS_BINARY for exchange binary message with TLS/SSL over TCP 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, string addr)
Where fd is the socket which received the data, and message is the data
which was received, addr is the client address.
In non-binary mode, message will be sanitized with UTF8 encoding and returned as an string.
In binary mode, raw messages will be returned as a buffer.
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.