Parag Gupta
Parag Gupta

Reputation: 117

Multiple TCP Socket Requests on PHP

Is it possible to accept multiple requests (parallel) by using a socket server made on PHP? If possible, how ?

Upvotes: 2

Views: 1084

Answers (1)

mario
mario

Reputation: 145482

A normal PHP script cannot receive multiple requests. But if you really plan on creating a socket server (started as cmdline php script), then yes it's possible.

Look into http://pear.php.net/package/Net_Server - it provides already some preparations for that. Specifically it uses the pcntl functions to fork into multiple processes to work on separate TCP requests.

Another option would be http://nanoserv.si.kz/ which has a few more features.

Upvotes: 1

Related Questions