ID:               15639
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Feedback
 Bug Type:         *Network Functions
 Operating System: All
 PHP Version:      4.1.1
 New Comment:

Can you try changing the FG(def_chunk_size) assignment
in the file_globals_ctor function in ext/standard/file.c
and hard-code it to 1.
Then try your UDP script.
If that solves the problem, I will add a method of
setting this from script (using set_file_buffer).
I still don't think using recvfrom will make any
difference.


Previous Comments:
------------------------------------------------------------------------

[2002-03-16 14:51:31] [EMAIL PROTECTED]

It also says it should only be used in connected sockets.
Here is a working exemple from a porky sourcecode I have :
loop:
len = recvfrom(sock, data, 50, 0, (struct sockaddr *)&sai, &s_sai);
printf("%d bytes from %s:%d -
%s\n",len,inet_ntoa(sai.sin_addr),ntohs(sai.sin_port),data);
goto loop;

The default size is 50, if the UDP packet is < 50 (ie:42) it will print
: 42 bytes from 192.168.0.1:8000 - This is only a test. This is only a
test!!

So if you modify the recv call to a recvfrom call, it won't break TCP
and will make UDP work a better way.

------------------------------------------------------------------------

[2002-03-16 12:16:29] [EMAIL PROTECTED]

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.

------------------------------------------------------------------------

[2002-02-21 20:07:45] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

In fact it's worst than that, setting the socket non-blocking makes
fread not working on unix/win.

------------------------------------------------------------------------

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

Reply via email to