Looks like something easy but I’m having real trouble.
I use curl, and I need to be able to do simultaneous connections.
The point is the server takes too long to respond, for example if I need the data every second and the server response lasts two seconds, with curl being synchronous will do a petition every two seconds+, and I want one petition every second no matter what it takes to respond.
So I try to use curl_multi_init, but that’s for making simultaneous connections all of them at the same time… I tried strange things but no result…
It’s like a simple action but I really don’t see how to do this with PHP.
How much data and what kind of server are you connecting to? Asking for a response once a second seems like a little much for a non beefed up server and also possibly for tcp in general. A socket connection, possibly even over udp might be what you are looking for. Can you supply alittle more background for us?
For now I continue working, or trying, with curl_multi. Now I’m able to add new connections while is executing, but its slower don’t know why, it makes 3 connection until it gets the data… and at higher frequencies it just don’t work.
Well to be more specific, the time between connections is less than a second, and the targeted server is usually prepared for that, as it receives petitions from many other servers, an at higher frequency, what limits me is my server not the other.
The function of this script is get “data” as soon as it’s released. In this matter every millisecond counts and I can’t wait to receive the response to make another connection due to the “relative” high latency of the connection.
The data itself is small.