I'm communicating with a server using UDP, and it can be
narrowed down to this:
$us = 75000; //Timeout in microseconds.
$con = fsockopen("udp://127.0.0.0","230 00");
stream_set_time out($con,0,$us) ;
fwrite($con"\xf f\info\");
$retval = fgets($con,1024 0);
My problem is that I allways have to wait for $us seconds.
So if I set it to 2 seconds, I have to wait for 2 seconds.
And if I set it to low, I might not wait long enough to get
an answer. So I've ended up using 0.075 seconds, which isn't
all that much. But I'd much rather find another way of
doing this, so that I can set the timeout as high as I like,
and still not have to wait longer than it takes to actually
retrieve the data.
Would reading one byte at a time, and check the last recieved
bytes for a known pattern resolve this...? Any suggestions?
-Fred
P.S. I haven't been able to play around and try different things
with this yet, due to deadlines on a couple of other projects...
--
Fred H
void FredH::Contact( ) {
TextToSpeach.sa y("frode at age dee dee dot en oh");
}
Comment