F.34. Sockets

FunctionReturnsDescription
socket_select(array &read_fds, array &write_fds, &array except_fds, int tv_sec[, int tv_usec])
intRuns the select() system call on the sets mentioned with a timeout specified by tv_sec and tv_usec.
socket_create_listen(int port[, int backlog])
resourceOpens a socket on port to accept connections.
socket_accept(resource socket)
resourceAccepts a connection on the listening socket fd.
socket_set_nonblock(resource socket)
boolSets nonblocking mode on a socket resource.
socket_set_block(resource socket)
boolSets blocking mode on a socket resource.
socket_listen(resource socket[, int backlog])
boolSets the maximum number of connections allowed to be waited for on the socket specified by fd.
socket_close(resource socket)
voidCloses a file descriptor.
socket_write(resource socket, string buf[, int length])
intWrites the buffer to the socket resource; length is optional.
socket_read(resource socket, int length [, int type])
stringReads a maximum of length bytes from socket.
socket_getsockname(resource socket, string &addr[, int
 &port])
boolQueries the remote side of the given socket, which may either result in host/port or in a UNIX filesystem path, dependent on its type.
socket_getpeername(resource socket, string &addr[, int
 &port])
boolQueries the remote side of the given socket, which may either result in host/port or in a UNIX filesystem path, dependent on its type.
socket_create(int domain, int type, int protocol)
resourceCreates an endpoint ...

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.