note 11190 deleted from ref.sockets by jimw
| From: | jimw@php.net | Date: | Fri, 21 Dec 2001 00:33:05 +0000 |
| Subject: | note 11190 deleted from ref.sockets by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23633@lists.php.net to get a copy of this message | ||
There are many undocumentated functions yet:
resource fd_alloc(void)
Allocates a file descriptor set
bool fd_dealloc(void)
De-allocates a file descriptor set
bool fd_set(int fd, resource set)
Adds a file descriptor to a set
bool fd_clear(int fd, resource set)
Clears a file descriptor from a set
bool fd_isset(int fd, resource set)
Checks to see if a file descriptor is set within the file descrirptor set
void fd_zero(resource set)
Clears a file descriptor set
int select(int max_fd, resource readfds, resource writefds, resource exceptfds, int tv_sec, int
tv_usec)
Runs the select() system call on the sets mentioned with a timeout specified by tv_sec and
tv_usec
int open_listen_sock(int port)
Opens a socket on port to accept connections
bool set_nonblock(int fd)
Sets nonblocking mode for file descriptor fd
int getsockname(int fd, string &addr[, int &port])
Given an fd, stores a string representing sa.sin_addr and the value of sa.sin_port into addr and
port describing the local side of a socket
int gethostbyname(string name, string &addr)
Given a hostname, sets addr to be a human-readable version of the host's address
int getpeername(int fd, string &addr[, int &port])
Given an fd, stores a string representing sa.sin_addr and the value of sa.sin_port into addr and
port describing the remote side of a socket
int gethostbyaddr(string addr, string &name)
Given a human-readable address, sets name to be the host's name
resource build_iovec(int num_vectors [, int ...])
Builds a 'struct iovec' for use with sendmsg, recvmsg, writev, and readv
First parameter is number of vectors, each additional parameter is the
length of the vector to create.
string fetch_iovec(resource iovec_id, int iovec_position)
Returns the data held in the iovec specified by iovec_id[iovec_position]
bool set_iovec(resource iovec_id, int iovec_position, string new_val)
Sets the data held in iovec_id[iovec_position] to new_val
bool add_iovec(resource iovec_id, int iov_len)
Adds a new vector to the scatter/gather array
bool delete_iovec(resource iovec_id, int iov_pos)
Deletes a vector from an array of vectors
bool free_iovec(resource iovec_id)
Frees the iovec specified by iovec_id
int readv(int fd, resource iovec_id)
Reads from an fd, using the scatter-gather array defined by iovec_id
int writev(int fd, resource iovec_id)
Writes to a file descriptor, fd, using the scatter-gather array defined by iovec_id
int recv(int fd, string buf, int len, int flags)
Receives data from a connected socket
May be used with SOCK_DGRAM sockets.
int send(int fd, string buf, int len, int flags)
Sends data to a connected socket
May be used with SOCK_DGRAM sockets.
int recvfrom(int fd, string &buf, int len, int flags, string &name [, int &port])
Receives data from a socket, connected or not
int sendto(int fd, string buf, int len, int flags, string addr [, int port])
Sends a message to a socket, whether it is connected or not
int recvmsg(int fd, resource iovec, array &control, int &controllen, int &flags, string
&addr [, int &port])
Used to receive messages on a socket, whether connection-oriented or not
int sendmsg(int fd, resource iovec, int flags, string addr [, int port])
Sends a message to a socket, regardless of whether it is connection-oriented or not
int getsockopt(int fd, int level, int optname, array|int &optval)
Gets socket options for the socket
If optname is SO_LINGER, optval is returned as an array with members
"l_onoff" and "l_linger", otherwise it is an integer.
int setsockopt(int fd, int level, int optname, int|array optval)
Sets socket options for the socket
If optname is SO_LINGER, optval is expected to be an array
with members "l_onoff" and "l_linger", otherwise it should be an integer.
int socketpair(int domain, int type, int protocol, array &fds)
Creates a pair of indistinguishable sockets and stores them in fds.
int shutdown(int fd, int how)
Shuts down a socket for receiving, sending, or both.