www.webdeveloper.com
Results 1 to 2 of 2

Thread: Socket server performance

  1. #1
    Join Date
    Feb 2007
    Posts
    22

    Socket server performance

    Hi there,
    I am setting up a socket server and all the examples I have seen use an infinite while(true) loop to keep the script alive and monitor for socket changes. There must be a better way as the loop alone uses 50% cpu with no connections.

    Is there no async event handling with sockets or way to keep a
    script (I know, script) alive without sleep()?

    Thanks.

  2. #2
    Join Date
    Nov 2008
    Posts
    10
    There is nothing out there unfortunately. PHP is strictly pre-processor, so once the page is idle and nothing else is being processed, you can't use php. You might want to steer away from it anyway. I would write a C program / daemon and call it with exec from php. Then all you have to do is update the page every so often.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles