Jump to content

sockets and multiple commands


jester2082

Recommended Posts

I'm trying to pull information from a server using a socket(which I have done). I have 80 different commands that I need to execute on the server and retrieve the results for. Each command looks like this:

 

$com1 = Connect($ip, $port, $command);

echo $com1;

 

If I just pass all of the connect statements (one per line) then php hangs and the page takes forever to load (sometimes doesn't). I found a workaround to this using sleep(1); but I don't want to have to wait 80 seconds to retrieve text that can be pulled much faster. Before this I had a connection that I could use to pass a single command that would return all 80 values that I need but the packets would get broken up so badly (udp) that I couldn't put them together again as halfway through some of the values where a new packet would start it would remove one of the letters of the value I was looking for and my function to search the retrieved data for that particular value would fail.

 

Is there a way to pass these commands without having to use sleep? Thanks for any help you guys can give!

Link to comment
https://forums.phpfreaks.com/topic/41853-sockets-and-multiple-commands/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.