On Tue, 2002-08-27 at 10:23, Torsten Schlabach wrote:
> Hi!
> 
> I am not sure if I
> a) misunderstood what the function is good for
> b) found a documentation problem or
> c) found a bug.
> 
> Maybe one of the more senior people on that list can advise me wether I
> should file a bug report or not.
> 
> I am writing some code in PHP that makes use of the socket_ functions and
> UDP communication. It is my understanding that the function socket_recvfrom()
> is supposed to read from the socket up to as many bytes as I tell it, store
> them in a buffer and fill in two variables that tell me from what address:port
> the packet that I just read actually came from.
> 
> Am I right with that?


yep

> 
> If so: Everything seems fine for me except that the buffer is always empty
> though the functions reports to me that it read n bytes. The other thing that
> scares me is that I can (or should I say: have to) issue an additional
> socket_read to read the same packet again; this time my buffer being filles.

I just took a look and it appears that socket_recvfrom is not binary
safe. I bet this is the problem you are seeing. Is this binary data you
are transmitting?

I will have commit binary safety for the fix shortly

-Jason

> 
> In fact I could leave out the socket_recvfrom() and just call socket_read,
> but that way I do not get to know the address:port of the sender.
> 
> But I don't think it is meant to be use that way (calling both functions one
> after the other) to get one packet, is it?
> 
> Any thoughts are welcome.
> 
> Regards,
> Torsten
> 
> 
> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to