[PHP-DOC] #27065 [Csd]: stream_socket_server won't listen on udp sockets

2004-01-28 Thread glox at glox dot be
 ID:   27065
 User updated by:  glox at glox dot be
 Reported By:  glox at glox dot be
 Status:   Closed
 Bug Type: Documentation problem
 Operating System: freeBSD 5.1
 PHP Version:  5CVS-2004-01-27 (dev)
 New Comment:

Isn't it better to let php define those flags then, based on the socket
type (udp/tcp).

I don't see any change in the example either ...


Previous Comments:


[2004-01-27 23:27:55] [EMAIL PROTECTED]

udp:// sockets should not attempt to listen().  Because
stream_socket_server() uses both the bind and listen flags by default
you need to explicitly set them to bind only.

I've fixed the example to reflect this.



[2004-01-27 21:29:17] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

Seems to work for me. 



[2004-01-27 16:02:25] otoria at freecode dot nl

Same problem: 
 
[EMAIL PROTECTED] ~$ uname -a 
Linux serenity 2.4.20 #2 Mon Mar 17 22:02:15 PST 2003 i686 
unknown 
[EMAIL PROTECTED] ~$ php -v 
PHP 5.0.0RC1-dev (cli) (built: Jan 26 2004 16:41:55) 
Copyright (c) 1997-2004 The PHP Group 
Zend Engine v2.0.0-dev, Copyright (c) 1998-2004 Zend 
Technologies 
[EMAIL PROTECTED] ~$



[2004-01-27 15:57:32] glox at glox dot be

The port is open, and I run this script as root

[EMAIL PROTECTED] /share/wolfd# sockstat | grep 27961
[EMAIL PROTECTED] /share/wolfd#

[EMAIL PROTECTED] /share/wolfd# whoami
root
[EMAIL PROTECTED] /share/wolfd#



[2004-01-27 15:53:21] glox at glox dot be

Description:

When trying to listen on a udp socket in freebsd with php5, php fails
to create the socket and returns unknown error.

The manual page gives an example about a udp server, however this
returns the same error.

Operating system (uname -a):

FreeBSD 5.1-RELEASE #0: Thu Jun  5 02:55:42 GMT 2003
[EMAIL PROTECTED]:/usr/obj/usr/src/sys/GENERIC

PHP version (php -v):

PHP 5.0.0RC1-dev (cli) (built: Jan 16 2004 22:47:26)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.0-dev, Copyright (c) 1998-2004 Zend Technologies

PHP configure line:
./configure --with-mysql=/usr/local/mysql --with-mime-magic
--with-apxs=/usr/local/sbin/apxs --enable-wddx --with-zlib
--enable-bcmath --with-bz2 --with-ncurses --enable-cli --disable-cgi
--with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir
--with-calender --enable-pcntl --enable-sysvsem --enable-sysvshm
--enable-sysvmsg --enable-exif --enable-sockets --with-xpm-dir
--with-gettext --with-gmp --enable-mbstring --with-xmlrpc --with-xsl
--with-ex --enable-openssl

Reproduce code:
---
?php
$sock = stream_socket_server('udp://0.0.0.0:27961');
?

Expected result:

No output

Actual result:
--
Warning: stream_socket_server(): unable to connect to
udp://0.0.0.0:27961 (Unknown error) in /share/wolfd/serv.php on line 2






-- 
Edit this bug report at http://bugs.php.net/?id=27065edit=1


[PHP-DOC] #27065 [Csd]: stream_socket_server won't listen on udp sockets

2004-01-28 Thread pollita
 ID:   27065
 Updated by:   [EMAIL PROTECTED]
 Reported By:  glox at glox dot be
 Status:   Closed
 Bug Type: Documentation problem
 Operating System: freeBSD 5.1
 PHP Version:  5CVS-2004-01-27 (dev)
 New Comment:

It'd be nice, but because of the way the transports layer operates it
won't happen without making exceptions on a per protocol basis and
that's gernerally not a good idea.

As to the documentation, the source has been updated, but the online
manual is only rebuilt from source on a periodic basis.

The change amounts to:

$server = stream_socket_server('udp://0.0.0.0:13/', $errno, $errstr,
STREAM_SERVER_BIND);


Previous Comments:


[2004-01-28 13:06:20] glox at glox dot be

Isn't it better to let php define those flags then, based on the socket
type (udp/tcp).

I don't see any change in the example either ...



[2004-01-27 23:27:55] [EMAIL PROTECTED]

udp:// sockets should not attempt to listen().  Because
stream_socket_server() uses both the bind and listen flags by default
you need to explicitly set them to bind only.

I've fixed the example to reflect this.



[2004-01-27 21:29:17] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

Seems to work for me. 



[2004-01-27 16:02:25] otoria at freecode dot nl

Same problem: 
 
[EMAIL PROTECTED] ~$ uname -a 
Linux serenity 2.4.20 #2 Mon Mar 17 22:02:15 PST 2003 i686 
unknown 
[EMAIL PROTECTED] ~$ php -v 
PHP 5.0.0RC1-dev (cli) (built: Jan 26 2004 16:41:55) 
Copyright (c) 1997-2004 The PHP Group 
Zend Engine v2.0.0-dev, Copyright (c) 1998-2004 Zend 
Technologies 
[EMAIL PROTECTED] ~$



[2004-01-27 15:57:32] glox at glox dot be

The port is open, and I run this script as root

[EMAIL PROTECTED] /share/wolfd# sockstat | grep 27961
[EMAIL PROTECTED] /share/wolfd#

[EMAIL PROTECTED] /share/wolfd# whoami
root
[EMAIL PROTECTED] /share/wolfd#



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/27065

-- 
Edit this bug report at http://bugs.php.net/?id=27065edit=1