hosted by liquidweb


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

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
  #1  
Old 10-05-2008, 11:05 AM
Adam Hallett Adam Hallett is offline
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.

Reply With Quote


Sponsored Links
  #2  
Old 10-05-2008, 01:43 PM
vibrokatana vibrokatana is offline
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.

Reply With Quote
  #3  
Old 10-05-2008, 11:19 PM
bqinternet bqinternet is offline
Backup Guru
 
Join Date: Feb 2002
Location: New York, NY
Posts: 4,477
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
*** http://www.bqbackup.com/ ***

Reply With Quote
Sponsored Links
Reply

Related posts from TheWhir.com
Title Type Date Posted
Swarmify's New Approach to Content Delivery Uses Site Visitors to Accelerate Content Web Hosting News 2014-05-01 08:34:03
Fortinet Updates DDoS Attack Mitigation Solution for New Threats Web Hosting News 2014-03-10 17:05:52
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
Texas Company Claims Web Encryption Infringes its Patent in Suit Against Intel, Yelp, Others Web Hosting News 2012-11-08 11:14:00


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
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com 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?