Re: [PHP] Socket error

2009-06-29 Thread Luke
2009/6/29 Daniel Brown 

> On Mon, Jun 29, 2009 at 02:42, Luke wrote:
> > Hey guys, getting an odd error here... The code involved:
> [snip!]
>
>Luke,
>
>Just a friendly reminder: for future reference, please don't start
> a second thread on the list until the first is closed out ---
> particularly if it's the same subject.  Sometimes responses to
> questions - particularly in the middle of a Sunday night - will take
> some time, but someone will eventually reply.
>
> --
> 
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> Ask me about our fully-managed servers and proactive management
> clusters starting at just $200/mo.!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Ah, that wasn't impatience, I have two email addresses and was unsure which
were allowed to post to the list but apparently it's both! Sorry about that.

In relation to the question, the answer was indeed to change to
socket_create, the following code works fine:

$master_socket = socket_create(AF_INET, SOCK_STREAM,
0);
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);

Thanks for the help =)

-- 
Luke Slater
:O)


Re: [PHP] Socket error

2009-06-29 Thread Daniel Brown
On Mon, Jun 29, 2009 at 02:42, Luke wrote:
> Hey guys, getting an odd error here... The code involved:
[snip!]

Luke,

Just a friendly reminder: for future reference, please don't start
a second thread on the list until the first is closed out ---
particularly if it's the same subject.  Sometimes responses to
questions - particularly in the middle of a Sunday night - will take
some time, but someone will eventually reply.

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Ask me about our fully-managed servers and proactive management
clusters starting at just $200/mo.!

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



Re: [PHP] Socket error

2009-06-29 Thread Per Jessen
Luke wrote:

> 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);
> 


I think you need to use socket_create() instead of
socket_create_listen().


/Per

-- 
Per Jessen, Zürich (21.9°C)


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



Re: [PHP] Socket error

2009-06-28 Thread Luke
2009/6/29 Stuart 

> 2009/6/29 Luke :
> > 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
>
>
Unfortunately that doesn't make a difference :(

-- 
Luke Slater
:O)


Re: [PHP] Socket error

2009-06-28 Thread Stuart
2009/6/29 Luke :
> 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



[PHP] Socket error

2009-06-28 Thread Luke
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!


-- 
Luke Slater
:O)


[PHP] Socket error

2009-06-28 Thread Luke
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!

-- 
Luke Slater
:O)


Re: [PHP] Socket error connecting to mySQL

2003-02-04 Thread victor
did u turn mysql on?

end of mysql installation output:

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
This is done with:
/usr/bin/mysqladmin -u root  password 'new-password'
/usr/bin/mysqladmin -u root -h 
CPE00022af118a5-CM024330008757.cpe.net.cable.rogers.com  password 
'new-password'
See the manual for more instructions.

NOTE:  If you are upgrading from a MySQL <= 3.22.10 you should run
the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be
able to use the new GRANT command!

You can start the MySQL daemon with:
cd / ; /usr/bin/safe_mysqld &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' 
directory:
cd sql-bench ; run-all-tests

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com

Bryan Lipscy wrote:
$db= @mysql_pconnect ( $DB_HOST , $DB_USER , $DB_PASS );
@mysql_select_db ( $DB_DB )  or die ( "DATABASE ERROR!".mysql_error() );

Returns DATABASE ERROR!Can't connect to local MySQL server through
socket '/tmp/mysql.sock' (2)

MySQL server exists on a Win2ksp3 box.
Apache with PHP 4.3.0 exists on a Slackware 8.1 box.

All parameters are correct.
Boxes can see each other.
All php scripts work when run on the Win2k box.


Any ideas why connecting to php/mysql would throw this error?

Bryan






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




Re: [PHP] Socket error connecting to mySQL

2003-02-04 Thread Nick Kordas -: Wildthing Communications
Hi
I think that you mysql server on your Win box is set to only connect from
localhost and not from an outside host which is what its trying to do.



-
Regards
Nick Kordas BE(hons) Ph.D(usyd)
Wildthing Communications
PH:  07 5481 6064
Mob: 0421 556847
ICQ# 64851373
PO Box 1841
SUNSHINE PLAZA
Maroochydore
QLD 4558
http://www.wildcomm.net


~~~
How can a species, that can create machines to communicate, fail to
communicate amongst themselves ?

~~~
This email and any files transmitted with it may be legally privileged and
confidential. If you
are not the intended recipient of this email, you must not disclose or use
the information contained
in it. If you have received this email in error, please notify us by return
email and permanently
delete the document.

~~~

- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 04, 2003 6:12 PM
Subject: Re: [PHP] Socket error connecting to mySQL


> On Friday 21 February 2003 15:49, Bryan Lipscy wrote:
> > $db= @mysql_pconnect ( $DB_HOST , $DB_USER , $DB_PASS );
> > @mysql_select_db ( $DB_DB )  or die ( "DATABASE ERROR!".mysql_error() );
> >
> > Returns DATABASE ERROR!Can't connect to local MySQL server through
> > socket '/tmp/mysql.sock' (2)
> >
> > MySQL server exists on a Win2ksp3 box.
> > Apache with PHP 4.3.0 exists on a Slackware 8.1 box.
> >
> > All parameters are correct.
> > Boxes can see each other.
> > All php scripts work when run on the Win2k box.
> >
> >
> > Any ideas why connecting to php/mysql would throw this error?
>
> Search the archives or search the mysql list archives.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> Loose bits sink chips.
> */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] Socket error connecting to mySQL

2003-02-04 Thread Jason Wong
On Friday 21 February 2003 15:49, Bryan Lipscy wrote:
> $db= @mysql_pconnect ( $DB_HOST , $DB_USER , $DB_PASS );
> @mysql_select_db ( $DB_DB )  or die ( "DATABASE ERROR!".mysql_error() );
>
> Returns DATABASE ERROR!Can't connect to local MySQL server through
> socket '/tmp/mysql.sock' (2)
>
> MySQL server exists on a Win2ksp3 box.
> Apache with PHP 4.3.0 exists on a Slackware 8.1 box.
>
> All parameters are correct.
> Boxes can see each other.
> All php scripts work when run on the Win2k box.
>
>
> Any ideas why connecting to php/mysql would throw this error?

Search the archives or search the mysql list archives.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Loose bits sink chips.
*/


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




[PHP] Socket error connecting to mySQL

2003-02-03 Thread Bryan Lipscy
$db= @mysql_pconnect ( $DB_HOST , $DB_USER , $DB_PASS );
@mysql_select_db ( $DB_DB )  or die ( "DATABASE ERROR!".mysql_error() );

Returns DATABASE ERROR!Can't connect to local MySQL server through
socket '/tmp/mysql.sock' (2)

MySQL server exists on a Win2ksp3 box.
Apache with PHP 4.3.0 exists on a Slackware 8.1 box.

All parameters are correct.
Boxes can see each other.
All php scripts work when run on the Win2k box.


Any ideas why connecting to php/mysql would throw this error?

Bryan


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




Re: [PHP] socket error

2001-09-07 Thread Sterling Hughes

On Sat, 8 Sep 2001, sagar wrote:

> thanX sterling,
>
> i've changed it to socket_open()  but the problem
> still exists.
>

Sorry, meant socket_create() -- for a list of the new names, open up
php4/ext/sockets/sockets.c and take a look at the function entry.

-Sterling

> /sagar
>
> - Original Message -
> From: Sterling Hughes <[EMAIL PROTECTED]>
> To: sagar <[EMAIL PROTECTED]>
> Cc: php <[EMAIL PROTECTED]>
> Sent: Saturday, September 08, 2001 1:54 AM
> Subject: Re: [PHP] socket error
>
>
> > On Sat, 8 Sep 2001, sagar wrote:
> >
> > > line10 -> if (($sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
> > > echo "socket() failed: reason: " . strerror($sock) .
> "\n";
> > > }
> > >
> > > i'm getting an error saying
> > > Fatal error: Call to undefined function: socket() in c:\program
> files\apache group\apache\htdocs\test\sock.php on line 10
> > >
> > >
> > > can any one help
> > >
> >
> > The socket functions have been renamed as of php4.0.7
> >
> > Use socket_open() instead...
> >
> > -Sterling
>
>
> _
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] socket error

2001-09-07 Thread sagar

thanX sterling,

i've changed it to socket_open()  but the problem
still exists.

/sagar

- Original Message -
From: Sterling Hughes <[EMAIL PROTECTED]>
To: sagar <[EMAIL PROTECTED]>
Cc: php <[EMAIL PROTECTED]>
Sent: Saturday, September 08, 2001 1:54 AM
Subject: Re: [PHP] socket error


> On Sat, 8 Sep 2001, sagar wrote:
>
> > line10 -> if (($sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
> > echo "socket() failed: reason: " . strerror($sock) .
"\n";
> > }
> >
> > i'm getting an error saying
> > Fatal error: Call to undefined function: socket() in c:\program
files\apache group\apache\htdocs\test\sock.php on line 10
> >
> >
> > can any one help
> >
>
> The socket functions have been renamed as of php4.0.7
>
> Use socket_open() instead...
>
> -Sterling


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] socket error

2001-09-07 Thread Sterling Hughes

On Sat, 8 Sep 2001, sagar wrote:

> line10 -> if (($sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
> echo "socket() failed: reason: " . strerror($sock) . "\n";
> }
>
> i'm getting an error saying
> Fatal error: Call to undefined function: socket() in c:\program files\apache 
>group\apache\htdocs\test\sock.php on line 10
>
>
> can any one help
>

The socket functions have been renamed as of php4.0.7

Use socket_open() instead...

-Sterling


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] socket error

2001-09-07 Thread sagar

line10 -> if (($sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
echo "socket() failed: reason: " . strerror($sock) . "\n";
}

i'm getting an error saying
Fatal error: Call to undefined function: socket() in c:\program files\apache 
group\apache\htdocs\test\sock.php on line 10


can any one help

its urgent

/sagar