XCV. Socket functions
אזהרה
|
רכיב
זה
הוא
ניסיוני
.
כלומר
,
התנהגות
הפונקציות,שמות
הפונקציות
ובאופן
כללי
כל
מה
שמתועד
כאן
עשוי
להשתנות
בהפצה
עתידית
של
PHP
ללא
התרעה
.
ראה
הוזהרת
,
השימוש
ברכיב
זה
על
אחריותך
בלבד
.
|
Almost
all
of
the
sockets
functions
may
fail
under
certain
conditions
and
therefore
emit
an
E_WARNING
Almost
all
of
the
sockets
functions
may
fail
under
certain
conditions
and
therefore
emit
an
E_WARNING
message
describing
the
error
.
That
said
,
those
unfamiliar
with
socket
programming
can
still
find
a
lot
of
useful
material
in
the
appropriate
Unix
man
pages
,
and
there
is
a
great
deal
of
tutorial
information
on
socket
programming
in
C
on
the
web
,
much
of
which
can
be
applied
,
with
slight
modifications
,
to
socket
programming
in
PHP
.
דוגמה
1
.
Change
the
address
and
port
variables
to
suit
your
setup
and
execute
.
|
-
תוכן העניינים:
-
socket_accept
-- Accepts a connection on a socket
-
socket_bind
-- Binds a name to a socket
-
socket_clear_error
-- Clears the error on the socket or the last error
code
-
socket_close
-- Closes a socket resource
-
socket_connect
-- Initiates a connection on a socket
-
socket_create
-- Create a socket (endpoint for communication)
-
socket_create_listen
-- Opens a socket on port to accept connections
-
socket_create_pair
-- Creates a pair of indistinguishable sockets and stores
them in fds.
-
socket_get_option
-- Gets socket options for the socket
-
socket_getpeername
-- Queries 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_getsockname
-- Queries the local side of the given socket which may
either result in host/port or in a UNIX filesystem path,
dependent on its type.
-
socket_iovec_add
-- Adds a new vector to the scatter/gather array
-
socket_iovec_alloc
-- ...]) Builds a 'struct iovec' for use with sendmsg,
recvmsg, writev, and readv
-
socket_iovec_delete
-- Deletes a vector from an array of vectors
-
socket_iovec_fetch
-- Returns the data held in the iovec specified by
iovec_id[iovec_position]
-
socket_iovec_free
-- Frees the iovec specified by iovec_id
-
socket_iovec_set
-- Sets the data held in iovec_id[iovec_position] to
new_val
-
socket_last_error
-- Returns the last error on the socket
-
socket_listen
-- Listens for a connection on a socket
-
socket_read
-- Reads a maximum of length bytes from socket
-
socket_readv
-- Reads from an fd, using the scatter-gather array
defined by iovec_id
-
socket_recv
-- Receives data from a connected socket
-
socket_recvfrom
-- Receives data from a socket, connected or not
-
socket_recvmsg
-- Used to receive messages on a socket, whether
connection-oriented or not
-
socket_select
-- Runs the select() system call on the given arrays of
sockets with a timeout specified by tv_sec and
tv_usec
-
socket_send
-- Sends data to a connected socket
-
socket_sendmsg
-- Sends a message to a socket, regardless of whether it
is connection-oriented or not
-
socket_sendto
-- Sends a message to a socket, whether it is connected
or not
-
socket_set_nonblock
-- Sets nonblocking mode for file descriptor fd
-
socket_set_option
-- Sets socket options for the socket
-
socket_shutdown
-- Shuts down a socket for receiving, sending, or
both.
-
socket_strerror
-- Return a string describing a socket error
-
socket_write
-- Write to a socket
-
socket_writev
-- Writes to a file descriptor, fd, using the
scatter-gather array defined by iovec_id