Oops forgot the message body on the last one.... Ok so after sleeping on it I don't think my solution was totally in line with the beauty and simplicity of php, I expect you should be able to pass either a hostname or a valid ip in the addr arg. Anyway the other part that confused me is that in the case of the gethostbyname failure I would have thought that the inability to bind and the PHP_SOCKET_ERROR and return FALSE should have killed the sript, but somehow the script continued and what's more confusing is that the system still manaed to bind a random port? I'll through it some more..
-e Eric Liedtke wrote: > I'm new in town here, so to speak, so I'm not sure about > proper protocol here, but I found,what I feel is a problem > in the socket extension code. Specifically in the socket_bind > function. I was working with a friends code and it was > trying to bind to port 80, however when I would check with > sockstat it was showing the process bound to a random port. > So I started poking around and found that if the addr argument, > (which by the way defaults to 0 in the code I was working with) > wasn't a valid name the bind function was set to fail because > the gethostbyname test would fail. I would propose that if > the sock_family is AF_INET the addr arg should be a valid > ip address and that a gethostbyname function be made > available to do name to ip conversion if a user needs it. > We already know we are binding an AF_INET family socket > by the case statement so all we should need to do is fill in the > address and the AF_INET into the sockaddr. I'd be happy > to provide an implementation, but wanted to see others > opinions before I did anything. > > Eric Liedtke > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php