win32 (net-receive-udp)

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

win32 (net-receive-udp)

Post by newdep »

Hello Lutz,

Im wondering how (net-receive-udp) is used under windows.

As it states in the manual and works pratical that (net-receive-udp) under
windows must have the EXACT amount of bytes it should receive or otherwise it returns "nil".

Actualy that is true on protocol base like Tftp. But plain udp
you never know how big the packets size will be.


So how can the net-receive-udp know how big the size of the packet is
that is coming in?

If i create a simple UDP server under windows in C then i can receive
all kinds of data packages. So my question, is this packetsize receive on Windows a windows or a newlisp behaviour?

Regards, Norman
-- (define? (Cornflakes))

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

I am also wondering, since I used it as the max-parameter, and it worked for me in that way.

Is it only a wrong doc?
Hans-Peter

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

well the newlisp doc says it and the test with (net-receive-udp) and (net-send-udp) states it..so under newlisp there is this behaviour for sure..

When I connect with a (net-send-udp) towards my Socket program in C
I simple can receive any length..Also other langugages dont have this limitation..(udp broadcast or not both work)

I can emagine its a precausion from lutz to protect udp packets under windows
but then again? what can wrong? length is length?

Norman...
-- (define? (Cornflakes))

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

The manual does not describe it correctly, this is what is correct:

Both Linux and Windows will receive less or equal than the amount specified. Linux will simply cut of bytes over the maximum but Windows will fail with nil and net-error is set to "8 Socket recv failed" if receiveing over the maximum.

So on both OS simply specify the maxbytes big enough and you will receive everything.

The difference is due to the implementation of the socket call recvfrom(). On Linux it will cut off bytes on Windows it will return an error.

Lutz

ps: Manual will be corrected for the next version.

Locked