Sockets Question

From: Date: Sat, 06 Apr 2002 06:29:01 +0000
Subject: Sockets Question
Groups: php.dev 
Request: Send a blank email to php-dev+get-82171@lists.php.net to get a copy of this message
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

« previous php.dev (#82171) next »