[ Index ] |
|
Code source de phpMyVisites 2.3 |
[Code source] [Imprimer] [Statistiques]
(pas de description)
Poids: | 528 lignes (15 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 0 fois |
Nécessite: | 0 fichiers |
Net_Socket:: (19 méthodes):
connect()
disconnect()
isBlocking()
setBlocking()
setTimeout()
getStatus()
gets()
read()
write()
writeLine()
eof()
readByte()
readWord()
readInt()
readString()
readIPAddress()
readLine()
readAll()
select()
Classe: Net_Socket - X-Ref
Generalized Socket class.connect($addr, $port = 0, $persistent = null, $timeout = null, $options = null) X-Ref |
Connect to the specified port. If called when the socket is already connected, it disconnects and connects again. param: string $addr IP address or host name. param: integer $port TCP port number. param: boolean $persistent (optional) Whether the connection is param: integer $timeout (optional) How long to wait for data. param: array $options See options for stream_context_create. return: boolean | PEAR_Error True on success or a PEAR_Error on failure. |
disconnect() X-Ref |
Disconnects from the peer, closes the socket. return: mixed true on success or an error object otherwise |
isBlocking() X-Ref |
Find out if the socket is in blocking mode. return: boolean The current blocking mode. |
setBlocking($mode) X-Ref |
Sets whether the socket connection should be blocking or not. A read call to a non-blocking socket will return immediately if there is no data available, whereas it will block until there is data for blocking sockets. param: boolean $mode True for blocking sockets, false for nonblocking. return: mixed true on success or an error object otherwise |
setTimeout($seconds, $microseconds) X-Ref |
Sets the timeout value on socket descriptor, expressed in the sum of seconds and microseconds param: integer $seconds Seconds. param: integer $microseconds Microseconds. return: mixed true on success or an error object otherwise |
getStatus() X-Ref |
Returns information about an existing socket resource. Currently returns four entries in the result array: <p> timed_out (bool) - The socket timed out waiting for data<br> blocked (bool) - The socket was blocked<br> eof (bool) - Indicates EOF event<br> unread_bytes (int) - Number of bytes left in the socket buffer<br> </p> return: mixed Array containing information about existing socket resource or an error object otherwise |
gets($size) X-Ref |
Get a specified line of data return: $size bytes of data from the socket, or a PEAR_Error if |
read($size) X-Ref |
Read a specified amount of data. This is guaranteed to return, and has the added benefit of getting everything in one fread() chunk; if you know the size of the data you're getting beforehand, this is definitely the way to go. param: integer $size The number of bytes to read from the socket. return: $size bytes of data from the socket, or a PEAR_Error if |
write($data, $blocksize = null) X-Ref |
Write a specified amount of data. param: string $data Data to write. param: integer $blocksize Amount of data to write at once. return: mixed true on success or an error object otherwise |
writeLine($data) X-Ref |
Write a line of data to the socket, followed by a trailing "\r\n". return: mixed fputs result, or an error |
eof() X-Ref |
Tests for end-of-file on a socket descriptor. return: bool |
readByte() X-Ref |
Reads a byte of data return: 1 byte of data from the socket, or a PEAR_Error if |
readWord() X-Ref |
Reads a word of data return: 1 word of data from the socket, or a PEAR_Error if |
readInt() X-Ref |
Reads an int of data return: integer 1 int of data from the socket, or a PEAR_Error if |
readString() X-Ref |
Reads a zero-terminated string of data return: string, or a PEAR_Error if |
readIPAddress() X-Ref |
Reads an IP Address and returns it in a dot formated string return: Dot formated string, or a PEAR_Error if |
readLine() X-Ref |
Read until either the end of the socket or a newline, whichever comes first. Strips the trailing newline from the returned data. return: All available data up to a newline, without that |
readAll() X-Ref |
Read until the socket closes, or until there is no more data in the inner PHP buffer. If the inner buffer is empty, in blocking mode we wait for at least 1 byte of data. Therefore, in blocking mode, if there is no data at all to be read, this function will never exit (unless the socket is closed on the remote end). return: string All data until the socket closes, or a PEAR_Error if |
select($state, $tv_sec, $tv_usec = 0) X-Ref |
Runs the equivalent of the select() system call on the socket with a timeout specified by tv_sec and tv_usec. param: integer $state Which of read/write/error to check for. param: integer $tv_sec Number of seconds for timeout. param: integer $tv_usec Number of microseconds for timeout. return: False if select fails, integer describing which of read/write/error |
Généré le : Mon Nov 26 14:10:01 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |