Re: Limit to the number of sockets socket_select can supervise?

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

 



Let me attack this. I'm bored.
I'm on Windows XP SP 2, and I'll try this from the command line.

I coded a simple server in PHP that just accepts the connection and listens. It doesn't attempt to send any data, its only select loop is to wait for a new connection attempt. I also wrote a load program. When attempted with 49 sockets (50 on the server), it worked fine, select and all.

	Server: http://labs.jed.bz/HCJ/server.php.txt
	Client: http://labs.jed.bz/HCJ/load.php.txt

However, when I tried 500, odd things happened.
The server (!) died due to Windows XP's DEP, which I removed for cli.exe and retried. It then died again (!) because of "an existing connection [being] forcibly closed".


I then lowered the limit to 70 and tried again. The server accepted 69:

accepted #68 of 70 accepted #69 of 70 .......................

Before I could telnet in to make 70, the client died:

connecting #69 of 69 ... ok waiting for spew Warning: socket_select(): unable to select [0]: An operation was attempted on something that is not a socket. in F:\Projects\HCJ\load.php on line 38 spew! done!

Curious. The problem replicates itself here.
I'm not sure. For the first time with PHP I honestly have no clue where to start attacking this problem. It could be a Windows limitation, but for that to be the case the scripts will have to be run on a UNIX system as well.


I simply don't know. Very strange indeed. It was worth the hour I put into it, because I'm interested -- I've been playing with PHP daemons on Win32 for a while now, and this select limitation concerns me.

I'll submit this as a bug report. Feel free to comment, bug #30852

Jed


Hans-Christian Jehg wrote:
Hi

Im building a TCP server in PHP 5.0.2 on Windows. It will have to serve a lot of clients (500+) with low traffic.

During this I have noticed that socket_select seems unable to supervise more than 64 connections at a time (Not good when I need 500+). It stops with a message that

"Socket select failed, error code is: 10038, error message is: An operation was at tempted on something that is not a socket."

These are the outputs of socket_last_error() and socket_strerror(socket_last_error()).

And now forthe questions:

Does any of you have the same experience?

Is it something to do with Windows? Does this limitation exist on Linux?

Is it just a bug?

Any good suggestions?

Best regards
and thanx in advance

HC


--
     _
    (_)___    Jed Smith, Code Ninja
    | / __|   RFBs: [email for info]
    | \__ \   +1 (541) 606-4145
   _/ |___/   jed@xxxxxx (Signed mail preferred: PGP 0x703F9124)
  |__/        http://personal.jed.bz/keys/jedsmith.asc

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