Re: Socket error
| From: | Stuart | Date: | Mon, 29 Jun 2009 06:47:36 +0000 |
| Subject: | Re: Socket error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-294702@lists.php.net to get a copy of this message | ||
2009/6/29 Luke <luke@blog-thing.com>:
> Hey guys, getting an odd error here... The code involved:
>
> $master_socket = socket_create_listen($this->port);
>
> socket_bind($master_socket, '127..0.0.1', $this->port);
> socket_listen($master_socket);
> socket_set_option($master_socket, SOL_SOCKET, SO_REUSEADDR, 1);
> socket_set_nonblock($master_socket);
>
> And I'm getting:
>
> 'PHP Warning: socket_bind(): unable to bind address [22]: Invalid argument
> in /home/luke/talkserver/new/classes/server.php online 30'
>
> $this->port is valid, I've checked both this and that socket_create_listen
> seems to be executing correctly.
>
> I'm a bit lost on the error too it seems to be what the php.net manual says
> are the parameters?
>
> I'm trying to create a listening socket server that binds to a port on the
> local machine.
>
> Thanks in advance for any help!
What port are you trying to bind to? If it's <= 1024 then you need to
run it as a privileged user.
-Stuart
--
http://stut.net/