[PHP-DOC] cvs: phpdoc /en/functions sockets.xml
darvina Tue Apr 9 15:44:05 2002 EDT Modified files: /phpdoc/en/functionssockets.xml Log: Removed extra word from refpupose of socket_setopt Index: phpdoc/en/functions/sockets.xml diff -u phpdoc/en/functions/sockets.xml:1.34 phpdoc/en/functions/sockets.xml:1.35 --- phpdoc/en/functions/sockets.xml:1.34Wed Feb 6 05:06:11 2002 +++ phpdoc/en/functions/sockets.xml Tue Apr 9 15:44:05 2002 -1,5 +1,5 ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.34 $ -- +!-- $Revision: 1.35 $ -- reference id=ref.sockets titleSocket functions/title titleabbrevSockets/titleabbrev -1122,7 +1122,7 refentry id=function.socket-setopt refnamediv refnamesocket_setopt/refname -refpurpose|array optval) Sets socket options for the socket /refpurpose +refpurposeSets socket options for the socket/refpurpose /refnamediv refsect1 titleDescription/title
[PHP-DOC] cvs: phpdoc /en/functions sockets.xml
torben Wed Feb 6 05:06:12 2002 EDT Modified files: /phpdoc/en/functionssockets.xml Log: Small example fix. Index: phpdoc/en/functions/sockets.xml diff -u phpdoc/en/functions/sockets.xml:1.33 phpdoc/en/functions/sockets.xml:1.34 --- phpdoc/en/functions/sockets.xml:1.33Sun Feb 3 02:10:50 2002 +++ phpdoc/en/functions/sockets.xml Wed Feb 6 05:06:11 2002 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.33 $ -- +!-- $Revision: 1.34 $ -- reference id=ref.sockets titleSocket functions/title titleabbrevSockets/titleabbrev @@ -55,6 +55,10 @@ /* Allow the script to hang around waiting for connections. */ set_time_limit (0); + +/* Turn on implicit output flushing so we see what we're getting + * as it comes in. */ +ob_implicit_flush (); $address = '192.168.1.53'; $port = 1;
[PHP-DOC] cvs: phpdoc /en/functions sockets.xml
mfischerSun Feb 3 02:10:51 2002 EDT Modified files: /phpdoc/en/functionssockets.xml Log: - Remove typo in socket_close(). Index: phpdoc/en/functions/sockets.xml diff -u phpdoc/en/functions/sockets.xml:1.32 phpdoc/en/functions/sockets.xml:1.33 --- phpdoc/en/functions/sockets.xml:1.32Sat Feb 2 10:36:09 2002 +++ phpdoc/en/functions/sockets.xml Sun Feb 3 02:10:50 2002 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.32 $ -- +!-- $Revision: 1.33 $ -- reference id=ref.sockets titleSocket functions/title titleabbrevSockets/titleabbrev @@ -279,7 +279,7 @@ refsect1 titleDescription/title methodsynopsis - typebool/typemethodnamesoclet_close/methodname + typebool/typemethodnamesocket_close/methodname methodparamtyperesource/typeparametersocket/parameter/methodparam /methodsynopsis warn.experimental.func;
[PHP-DOC] cvs: phpdoc /en/functions sockets.xml
mfischerWed Jan 9 11:51:46 2002 EDT Modified files: /phpdoc/en/functionssockets.xml Log: - Some proto corrections Index: phpdoc/en/functions/sockets.xml diff -u phpdoc/en/functions/sockets.xml:1.29 phpdoc/en/functions/sockets.xml:1.30 --- phpdoc/en/functions/sockets.xml:1.29Tue Jan 8 00:55:08 2002 +++ phpdoc/en/functions/sockets.xml Wed Jan 9 11:51:46 2002 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.29 $ -- +!-- $Revision: 1.30 $ -- reference id=ref.sockets titleSocket functions/title titleabbrevSockets/titleabbrev @@ -416,7 +416,7 @@ titleDescription/title funcsynopsis funcprototype - funcdefmixed functionsocket_read/function/funcdef + funcdefstring functionsocket_read/function/funcdef paramdefresource parametersocket_des/parameter/paramdef paramdefint parameterlength/parameter/paramdef paramdefint parameteroptionaltype/optional/parameter/paramdef @@ -469,7 +469,7 @@ titleDescription/title funcsynopsis funcprototype - funcdefint functionsocket_create/function/funcdef + funcdefresource functionsocket_create/function/funcdef paramdefint parameterdomain/parameter/paramdef paramdefint parametertype/parameter/paramdef paramdefint parameterprotocol/parameter/paramdef @@ -1034,7 +1034,7 @@ titleDescription/title funcsynopsis funcprototype - funcdefmixed functionsocket_recv/function/funcdef + funcdefstring functionsocket_recv/function/funcdef paramdefresource parametersocket/parameter/paramdef paramdefint parameterlen/parameter/paramdef paramdefint parameterflags/parameter/paramdef
Re: [PHP-DOC] cvs: phpdoc /en/functions sockets.xml
On Tue, Jan 08, 2002 at 05:55:09AM -, Georg Richter wrote : georg Tue Jan 8 00:55:09 2002 EDT Modified files: /phpdoc/en/functions sockets.xml Log: fixed Bug 14894 (examples and function prototype for socket_read) Can we please agree that a function whose primary return type is LONG/STRING/ARRAY/RESOURE/OBJECT and which may return FALSE/NULL _only_ in error condition has _not_ a mixed return value but has listed only its primary return value. Its less intuitive for users mixed? was it now int or string.. or even array ? but it rather makes sense that almost all functions return NULL/FALSE when encountering error conditions without setting the return type to mixed explicitely. -- Please always Cc to me when replying to me on the lists.
Re: [PHP-DOC] cvs: phpdoc /en/functions sockets.xml
On 2002-8-01 16:08, Markus Fischer wrote: On Tue, Jan 08, 2002 at 05:55:09AM -, Georg Richter wrote : georg Tue Jan 8 00:55:09 2002 EDT Modified files: /phpdoc/en/functionssockets.xml Log: fixed Bug 14894 (examples and function prototype for socket_read) Can we please agree that a function whose primary return type is LONG/STRING/ARRAY/RESOURE/OBJECT and which may return FALSE/NULL _only_ in error condition has _not_ a mixed return value but has listed only its primary return value. Its less intuitive for users mixed? was it now int or string.. or even array ? but it rather makes sense that almost all functions return NULL/FALSE when encountering error conditions without setting the return type to mixed explicitely. +1 -- Zak Greant PHP Quality Assurance Team http://qa.php.net/ We must be the change we wish to see. - M. K. Ghandi
[PHP-DOC] cvs: phpdoc /en/functions sockets.xml
georg Tue Jan 8 00:55:09 2002 EDT Modified files: /phpdoc/en/functionssockets.xml Log: fixed Bug 14894 (examples and function prototype for socket_read) Index: phpdoc/en/functions/sockets.xml diff -u phpdoc/en/functions/sockets.xml:1.28 phpdoc/en/functions/sockets.xml:1.29 --- phpdoc/en/functions/sockets.xml:1.28Wed Jan 2 06:45:00 2002 +++ phpdoc/en/functions/sockets.xml Tue Jan 8 00:55:08 2002 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.28 $ -- +!-- $Revision: 1.29 $ -- reference id=ref.sockets titleSocket functions/title titleabbrevSockets/titleabbrev @@ -76,13 +76,12 @@ break; } do { -$buf = ''; -$ret = socket_read ($msgsock, $buf, 2048); -if ($ret 0) { +$buf = socket_read ($msgsock, 2048); +if ($buf == FALSE) { echo socket_read() failed: reason: . socket_strerror ($ret) . \n; break 2; } -if ($ret == 0) { +if (!$buf) { break 2; } $buf = trim ($buf); @@ -148,7 +147,7 @@ echo OK.\n; echo Reading response:\n\n; -while (socket_read ($socket, $out, 2048)) { +while ($out = socket_read ($socket, 2048)) { echo $out; } @@ -411,13 +410,13 @@ refentry id=function.socket-read refnamediv refnamesocket_read/refname -refpurposeRead from a socket/refpurpose +refpurposeReads from a socket/refpurpose /refnamediv refsect1 titleDescription/title funcsynopsis funcprototype - funcdefint functionsocket_read/function/funcdef + funcdefmixed functionsocket_read/function/funcdef paramdefresource parametersocket_des/parameter/paramdef paramdefint parameterlength/parameter/paramdef paramdefint parameteroptionaltype/optional/parameter/paramdef @@ -429,7 +428,8 @@ parametersocket_des/parameter created by the functionsocket_accept/function function the number of bytes set by parameterlength/parameter. Otherwise you can use \n, \t or \0 to - end reading. Returns the bytes that were read. + end reading. Returns data, or FALSE if + functionsocket_read/function failed. /para para Optional parametertype/parameter parameter is a named constant:
[PHP-DOC] cvs: phpdoc /en/functions sockets.xml
jimwWed Jan 2 06:45:00 2002 EDT Modified files: /phpdoc/en/functionssockets.xml Log: socket_read: fix prototype, documentation Index: phpdoc/en/functions/sockets.xml diff -u phpdoc/en/functions/sockets.xml:1.27 phpdoc/en/functions/sockets.xml:1.28 --- phpdoc/en/functions/sockets.xml:1.27Mon Dec 17 05:30:32 2001 +++ phpdoc/en/functions/sockets.xml Wed Jan 2 06:45:00 2002 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.27 $ -- +!-- $Revision: 1.28 $ -- reference id=ref.sockets titleSocket functions/title titleabbrevSockets/titleabbrev @@ -419,7 +419,6 @@ funcprototype funcdefint functionsocket_read/function/funcdef paramdefresource parametersocket_des/parameter/paramdef - paramdefstring parameterbuffer/parameter/paramdef paramdefint parameterlength/parameter/paramdef paramdefint parameteroptionaltype/optional/parameter/paramdef /funcprototype @@ -427,11 +426,10 @@ warn.experimental.func; para The function functionsocket_read/function reads from socket - parametersocket_des/parametercreated by the - functionsocket_accept/function function into - parameterbuffer/parameter the number of bytes set by + parametersocket_des/parameter created by the + functionsocket_accept/function function the number of bytes set by parameterlength/parameter. Otherwise you can use \n, \t or \0 to - end reading. Returns number of bytes that have been read. + end reading. Returns the bytes that were read. /para para Optional parametertype/parameter parameter is a named constant:
[PHP-DOC] cvs: phpdoc /en/functions sockets.xml
hholzgraMon Dec 17 05:30:32 2001 EDT Modified files: /phpdoc/en/functionssockets.xml Log: renamed functions and added seletons for missing ones Index: phpdoc/en/functions/sockets.xml diff -u phpdoc/en/functions/sockets.xml:1.26 phpdoc/en/functions/sockets.xml:1.27 --- phpdoc/en/functions/sockets.xml:1.26Wed Dec 12 15:47:29 2001 +++ phpdoc/en/functions/sockets.xml Mon Dec 17 05:30:32 2001 @@ -1,5 +1,5 @@ ?xml version=1.0 encoding=iso-8859-1? -!-- $Revision: 1.26 $ -- +!-- $Revision: 1.27 $ -- reference id=ref.sockets titleSocket functions/title titleabbrevSockets/titleabbrev @@ -58,28 +58,28 @@ $address = '192.168.1.53'; $port = 1; -if (($sock = socket (AF_INET, SOCK_STREAM, 0)) 0) { -echo socket() failed: reason: . strerror ($sock) . \n; +if (($sock = socket_create (AF_INET, SOCK_STREAM, 0)) 0) { +echo socket_create() failed: reason: . socket_strerror ($sock) . \n; } -if (($ret = bind ($sock, $address, $port)) 0) { -echo bind() failed: reason: . strerror ($ret) . \n; +if (($ret = socket_bind ($sock, $address, $port)) 0) { +echo socket_bind() failed: reason: . socket_strerror ($ret) . \n; } -if (($ret = listen ($sock, 5)) 0) { -echo listen() failed: reason: . strerror ($ret) . \n; +if (($ret = socket_listen ($sock, 5)) 0) { +echo socket_listen() failed: reason: . socket_strerror ($ret) . \n; } do { -if (($msgsock = accept_connect($sock)) 0) { -echo accept_connect() failed: reason: . strerror ($msgsock) . \n; +if (($msgsock = socket_accept($sock)) 0) { +echo socket_accept() failed: reason: . socket_strerror ($msgsock) . \n; break; } do { $buf = ''; -$ret = read ($msgsock, $buf, 2048); +$ret = socket_read ($msgsock, $buf, 2048); if ($ret 0) { -echo read() failed: reason: . strerror ($ret) . \n; +echo socket_read() failed: reason: . socket_strerror ($ret) . \n; break 2; } if ($ret == 0) { @@ -87,17 +87,17 @@ } $buf = trim ($buf); if ($buf == 'quit') { -close ($msgsock); +socket_close ($msgsock); break 2; } $talkback = PHP: You said '$buf'.\n; -write ($msgsock, $talkback, strlen ($talkback)); +socket_write ($msgsock, $talkback, strlen ($talkback)); echo $buf\n; } while (true); -close ($msgsock); +socket_close ($msgsock); } while (true); -close ($sock); +socket_close ($sock); ? ]] /programlisting @@ -125,17 +125,17 @@ $address = gethostbyname ('www.php.net'); /* Create a TCP/IP socket. */ -$socket = socket (AF_INET, SOCK_STREAM, 0); +$socket = socket_create (AF_INET, SOCK_STREAM, 0); if ($socket 0) { -echo socket() failed: reason: . strerror ($socket) . \n; +echo socket_create() failed: reason: . socket_strerror ($socket) . \n; } else { -socket() successful: . strerror ($socket) . \n; +socket_create() successful: . socket_strerror ($socket) . \n; } echo Attempting to connect to '$address' on port '$service_port'...; -$result = connect ($socket, $address, $service_port); +$result = socket_connect ($socket, $address, $service_port); if ($result 0) { -echo connect() failed.\nReason: ($result) . strerror($result) . \n; +echo socket_connect() failed.\nReason: ($result) . socket_strerror($result) . +\n; } else { echo OK.\n; } @@ -144,16 +144,16 @@ $out = ''; echo Sending HTTP HEAD request...; -write ($socket, $in, strlen ($in)); +socket_write ($socket, $in, strlen ($in)); echo OK.\n; echo Reading response:\n\n; -while (read ($socket, $out, 2048)) { +while (socket_read ($socket, $out, 2048)) { echo $out; } echo Closing socket...; -close ($socket); +socket_close ($socket); echo OK.\n\n; ? ]] @@ -162,39 +162,39 @@ /para /partintro - refentry id=function.accept-connect + refentry id=function.socket-accept refnamediv -refnameaccept_connect/refname +refnamesocket_accept/refname refpurposeAccepts a connection on a socket/refpurpose /refnamediv refsect1 titleDescription/title funcsynopsis funcprototype - funcdefint functionaccept_connect/function/funcdef + funcdefint functionsocket_accept/function/funcdef paramdefresource parametersocket/parameter/paramdef /funcprototype /funcsynopsis warn.experimental.func; para After the socket parametersocket/parameter has been created - using functionsocket/function, bound to a name with - functionbind/function, and told to listen for connections - with functionlisten/function, this function will accept + using functionsocket_create/function, bound to a name with + functionsocket_bind/function, and told to listen for connections + with functionsocket_listen/function, this function will accept
[PHP-DOC] cvs: phpdoc /en/functions sockets.xml
sniper Tue Jun 26 12:44:10 2001 EDT Modified files: /phpdoc/en/functionssockets.xml Log: Since the PHP_SYSTEM_READ is same as PHP_BINARY_READ it is now removed. Index: phpdoc/en/functions/sockets.xml diff -u phpdoc/en/functions/sockets.xml:1.11 phpdoc/en/functions/sockets.xml:1.12 --- phpdoc/en/functions/sockets.xml:1.11Sun Jun 24 17:27:21 2001 +++ phpdoc/en/functions/sockets.xml Tue Jun 26 12:44:10 2001 @@ -427,17 +427,12 @@ itemizedlist listitem simpara -PHP_SYSTEM_READ - use the system read() +PHP_BINARY_READ - use the system read() (Default in PHP = 4.0.7) /simpara /listitem listitem simpara -PHP_BINARY_READ - binary safe read() (same as PHP_READ_SYSTEM) - /simpara - /listitem - listitem - simpara -PHP_NORMAL_READ - Default. Reading stops at \n or \r. +PHP_NORMAL_READ - reading stops at \n or \r. (Default in PHP = 4.0.6) /simpara /listitem /itemizedlist