hosted by liquidweb

Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : simultaneous sockets in php

Forum Jump

simultaneous sockets in php

Reply Post New Thread In Programming Discussion Subscription
Send news tip View All Posts Thread Tools Search this Thread Display Modes
WHT Addict
Join Date: Aug 2001
Posts: 123

simultaneous sockets in php

I need to open 100+ outbound socket connections in PHP. But while that is happening I obviously need to maintain and read data from the sockets that are open. I looked at process control and fork but i don't want to have 100 processes running independently of each other. Thoughts?

My current implementation opens a socket and then reads from and maintains the other sockets that are open. But even a low timeout value on fsockopen() could cause data to excessively pile up in the socket buffers and cause packets to be dropped.

Sponsored Links
Web Hosting Guru
Join Date: May 2008
Location: FL
Posts: 337
PHP doesn't support threading, so I don't think you will be able to do what you want there. You could possibly use a language that supports threading, or break it up into bits and do only a few connections per job.

Backup Guru
Join Date: Feb 2002
Location: New York, NY
Posts: 4,540
Sounds like a good candidate for socket_select(). Written properly, your loop can send and receive data only when the OS is ready for it.

Scott Burns, President
BQ Internet Corporation
Remote Rsync and FTP backup solutions
*** ***

Sponsored Links

Related posts from
Title Type Date Posted
Top 10 Tech Trends for 2015 Include Cloud Computing, Security: Gartner Web Hosting News 2014-10-10 09:45:13
New CloudFlare Keyless SSL Technology Could Prevent Future Bank Hacks Web Hosting News 2014-09-18 13:00:56
Swarmify's New Approach to Content Delivery Uses Site Visitors to Accelerate Content Web Hosting News 2014-05-01 08:34:03
Google Releases Hosted Database Service Cloud SQL to General Availability Web Hosting News 2014-02-12 13:46:02
Yahoo Will Encrypt All Data Moving Between its Data Centers Web Hosting News 2013-11-18 16:16:19

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Log in with your username and password

Forgot Password?
WHT Host Brief Email:

We respect your privacy. We will never sell, rent, or give away your address to any outside party, ever.

Web Hosting News:
WHT Membership
WHT Membership



Welcome to

Create your username to jump into the discussion! is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.

(4 digit year)

Already a member?