Home >Backend Development >PHP Tutorial >php socket function list
This article shares common functions in the php socket function library. Friends who study php socket programming can refer to it.
php socket function library: Function name Description socket_accept() accepts a Socket connection socket_bind() binds the socket to an IP address and port socket_clear_error() clears the socket error or last error code socket_close() closes a socket resource socket_connect() starts a socket connection socket_create_listen() opens a socket listening on the specified port socket_create_pair() generates a pair of undifferentiated sockets into an array socket_create() generates a socket, which is equivalent to generating a socket data structure socket_get_option() Get socket options socket_getpeername() Gets the IP address of a remote similar host socket_getsockname() gets the IP address of the local socket socket_iovec_add() adds a new vector to a scatter/gather array socket_iovec_alloc() This function creates an iovec data structure that can send, receive, read and write socket_iovec_delete() deletes an allocated iovec socket_iovec_fetch() returns the data of the specified iovec resource socket_iovec_free() releases an iovec resource socket_iovec_set() sets the new value of iovec data socket_last_error() gets the last error code of the current socket socket_listen() listens to all connections from the specified socket socket_read() reads data of specified length socket_readv() reads data from the scatter/aggregate array socket_recv() ends the data from the socket to the cache socket_recvfrom() accepts data from the specified socket. If not specified, it defaults to the current socket. socket_recvmsg() receives messages from iovec socket_select() multiple selection socket_send() This function sends data to the connected socket socket_sendmsg() sends message to socket socket_sendto() sends a message to the socket at the specified address socket_set_block() sets the socket to block mode socket_set_nonblock() Set the socket to non-block mode socket_set_option() sets socket options socket_shutdown() This function allows you to close the read, write, or specified socket socket_strerror() returns the detailed error with the specified error number socket_write() writes data to the socket cache socket_writev() writes data to scatter/aggregate array |