Bug #15639 Updated: detecting end of UDP packets

From: Date: Sat, 16 Mar 2002 17:16:29 +0000
Subject: Bug #15639 Updated: detecting end of UDP packets
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-2649@lists.php.net to get a copy of this message
ID: 15639 Updated by: wez@php.net Reported By: rip@undernet.org -Status: Open +Status: Feedback Bug Type: *Network Functions Operating System: All PHP Version: 4.1.1 New Comment: My man page says that recv is identical to recvfrom with a NULL from parameter, so I don't see how this can fix it. I still don't think this is technically possible over UDP. If you can show me some real working C code where it works, I will implement it. Previous Comments: ------------------------------------------------------------------------ [2002-02-21 20:07:45] rip@undernet.org In C, recvfrom() takes a length argument, but behaves with UDP like fread should : "Reading stops when length bytes have been read or EOF is reached, whichever comes first." Using recvfrom() with length set to 4096 will get the 20 bytes packets without blocking anything. The bug has prolly something to do with the use of recv() versus recvfrom(). ------------------------------------------------------------------------ [2002-02-20 22:42:53] wez@php.net I'll look into UDP sockets in PHP in more detail soon. In the meantime, I'm not sure that what you are suggesting is possible, since UDP is a connectionless protocol, how can we detect the end of a packet/stream? UDP is supposed to be used with known packet sizes. If you can show me some C code where what you propose works, I'll integrate it with the new PHP streams code. --Wez. ------------------------------------------------------------------------ [2002-02-20 07:02:31] rip@undernet.org In fact it's worst than that, setting the socket non-blocking makes fread not working on unix/win. ------------------------------------------------------------------------ [2002-02-20 06:41:24] rip@undernet.org It will kill Windows compatibility, fixing the functions is way better. ------------------------------------------------------------------------ [2002-02-20 06:35:09] wez@php.net What if you set the socket in non-blocking mode? Look for socket_set_blocking in the manual. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/15639 -- Edit this bug report at http://bugs.php.net/?id=15639&edit=1

« previous php.bugs (#2649) next »