#16664 [NoF->Csd]: PHP crashes on socket_bind

From: Date: Mon, 21 Apr 2003 20:05:52 +0000
Subject: #16664 [NoF->Csd]: PHP crashes on socket_bind
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38018@lists.php.net to get a copy of this message
 ID:               16664
 Updated by:       moriyoshi@php.net
 Reported By:      tech at kalyweb dot com
-Status:           No Feedback
+Status:           Closed
 Bug Type:         Sockets related
 Operating System: Windows 9x
 PHP Version:      4.2.0
 New Comment:

This looks more like a socket_strerror() problem that was addressed
recently, as the legacy winsock(1.1) doesn't report a correct errno
when bind() fails according to http://www.sockets.com/err_lst1.htm,

----------------------------------------------------------------------------
WSAEADDRNOTAVAIL (10049) Cannot assign requested address. 

Berkeley description: Normally results from an attempt to create a
socket with an address not on this machine. 

WinSock description: Partly the same as Berkeley. The "address" it
refers to is the remote socket name (protocol, port and address). This
error occurs when the sin_port value is zero in a sockaddr_in structure
for connect() or sendto(). 

In Berkeley, this error also occurs when you are trying to name the
local socket (assign local address and port number) with bind(), but
Windows Sockets doesn't ascribe this error to bind(), for some unknown
reason. 

Developer suggestions: Assume bind() will fail with this error. Let the
network system assign the default local IP address by referencing
INADDR_ANY in the sin_addr field of a sockaddr_in structure input to
bind(). Alternately, you can get the local IP address by calling
gethostname() followed by gethostbyname(). 

WinSock functions: connect(), sendto(), FD_CONNECT 

Additional functions: It seems odd that the v1.1 specification doesn't
ascribe this error to the function bind().

----------------------------------------------------------------------------



Previous Comments:
------------------------------------------------------------------------

[2003-04-16 04:24:53] menace at it dot dk

win98 will crash if you bind_socket your IP to other than yourself - IP
cant be 127.0.0.1 either

------------------------------------------------------------------------

[2002-08-25 01:00:09] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

[2002-04-18 10:59:11] mfischer@php.net

Wait, did you test with CVS now?!

It's supposed to ONLY return boolean false or true (from reading the
source code).

Can you verify this too please.

------------------------------------------------------------------------

[2002-04-18 09:27:38] tech at kalyweb dot com

Oops !!
I made an error, socket_bind returns 1 on success.
True = -1

------------------------------------------------------------------------

[2002-04-18 09:17:28] tech at kalyweb dot com

The CSV version doesn't include this bug anymore.

Just one more thing : socket_bind() returns '' on success ...

------------------------------------------------------------------------

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/16664

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



Thread (12 messages)

« previous php.bugs (#38018) next »