Re: Possible?

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

 



René Fournier wrote:
Simple problem: Many client apps need to send data to a server.

By default each client will open a persistent TCP socket connection to a common IP address:port (10.10.10.10:1234) and write to it (which the server will save/log, etc.).

My question is, what should be ready to listen at the IP:port? I was thinking of writing a PHP command-line socket server that listens at that port. But there will be a potentially huge number of clients connecting simultaneously (1000s), not transmitting a lot of data per se, but a lot of connections... Anyway, instead I thought writing a simple PHP script—say, listener.php—that gets executed by the web server and enters a socket_read loop until the client terminates the connection (set_time_limit(0)).

Does this sound like a good way to do it? This way, Apache handles all the connections, and PHP is instantiated each time, but without having to fork processes, etc, and without having to do PHP CLI.

Anyway, I've started looking at this, but I'm not quite sure if it's even possible. I mean, can "something" send a request to Apache, and continue to write data along that TCP socket? Normally, HTTP requests include GET or POST for such data, but this is not a a web browser that's opening the connection.

Hope I'm somewhat clear. Just struggling through some options here.... Anyway, thanks in advance for any suggestions.

...Rene

each client will open a persistent TCP socket connection to a
common IP address:port (10.10.10.10:1234)

(If you want simultaneous connections, each TCP connection will be to a
different port.)

But rather than write a client and a server application from scratch,
why not just use HTTP POSTs?

"Keep It Simple, Stewart."

--John

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