Re: Socket error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/6/29 Luke <luke@xxxxxxxxxxxxxx>:
> 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/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux