|
Posted by Adam on 09/27/05 05:06
On Mon, 26 Sep 2005 13:11:20 -0500, Jerry Stuckle wrote:
>OK, since your client doesn't have a firewall, this shouldn't be a
>problem. The reason I asked - if you have a firewall running on the
>client, the packets may arrive at the client (and you might see them
>with Ethereal), but they may be stopped before they get to the program.
Good thought. I hadn't considered the fact that a firewall could do
that. It's just possible that the firewall on the Linux box is
allowing *outgoing* traffic on 2934 but blocking *incoming*. I'll do
some digging around.
>As for the blocking mode - fsockopen() defaults to blocking mode, so the
>fread() should block until some data comes in. And if the data do
>arrive before you issue fread() (unlikely), the system should buffer it
>until you issue fread().
>However, this brings up another question. Does the fread() return
>immediately, or is there a delay before it returns? I'm wondering if
>it's possible that you are timing out on the fread() request. I'm not
>sure what the default timeout value is (timeout on the fsockopen only
>applies to making the connection) but you can use stream_set_timeout()
>to set it to a longer value.
Invariably, there's a delay. And this is for ALL types of socket read
that I try (simple fread or stream functions). Changing
stream_set_timeout() simply makes it sit there even longer - but in
many cases the whole script bombs out after 30 secs. Looking at the
ethereal output, that's around 29.999 secs too long <gg>.
>I really wish I could be more help here - but this is a problem I
>haven't run into before.
My feeling is that it's to do with the "connection-less" state of UDP
- and that the incoming packet is *not* being buffered by PHP (or the
script has already "missed the boat"). All experiments with TCP work
as advertised.
Are there any simple UDP tests I could try? I found a [local]
time-server script but I don't think I have a time server service
running on that machine, so I got no output either.
In all my googling, I've seen very few comments to convince me that
anyone has actually had UDP sockets working - plenty of reports of
(early) bugs in PHP with sockets though.
Appreciate your input so far - thanks!
Adam.
Navigation:
[Reply to this message]
|