I m working on Bandwidth Manger (to manage the bandwidth within lan) as my Final year project. I m using php but it seems that I must switch to java ....
Administrator PC will wait for http request .... The problem is that I establish socket connections ... then socket_listen waits for any type of request, & so hang other thing of web page. As I have to do this (listening the http port ) continously (endless loop), so none of the page contents will be displayed....
I need u guys opinion that should I switch to java or there is any solution ?? I will prefer the replies at "hassanrahman@yahoo.com"
Page doesn't load untill socket is completed
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
You can output the results as you receive them with output buffering, although I don't think your approaching this from the right angle.
Personally, I would have a listener script like you have, which inserts information into another source which can be read, such as a database and using another page to view the results. To keep the data coming in live, you'll likely need to use AJAX, unless you don't mind page refreshes.
Personally, I would have a listener script like you have, which inserts information into another source which can be read, such as a database and using another page to view the results. To keep the data coming in live, you'll likely need to use AJAX, unless you don't mind page refreshes.
You can use non-blocking on both the connection and the stream and then you don't have to wait on anything, so you can do other stuff and read from the stream when there is data waiting to be processed. Most people think PHP can not handle multi processes without forking, but that is not true, because PHP can handle hundreds of sockets at one time, your only limited by how much memory you have given PHP or how many sockets your OS can handle.
printf
printf