Re: UDP network problem

mshar@vax.ipm.ac.ir
Wed, 20 Aug 1997 07:37:42 +0330


Hi,

Alan Advised to increase the queue length of the slip driver (tx_queue_len,
in file drivers/net/slip.c) from 10 to 100. I did it, and now it is possible
to send larger packets using UDP! Thanks Alan.

However I doubt if this is a general solution. One might need to transfer
arbitrary long messages using UDP. I wonder how TCP is dealing with this
problem: if I am not mistaken, UDP and TCP wind up using the same driver.

Is there a way to get and set the MTU or the number of buffers, from a user
space program? If so, then one could try adjusting them to suit the size of
the data he wants to transfer.

Unfortunately there is an absolute packet size limit in the kernel (64K
bytes, I think), and it seems that breaking up the data to smaller sections
and sending them one after the other does not work. Here is part of the code
I used for the sender. In the receiver, a recvfrom() is used in a similar
loop, but no min() function is used there

nleft = nbytes; /* bytes to send */
while(nleft > 0)
{
nread = sendto(socket, ptr, min(nleft, 3000), 0, destination_addr, addr_len);
...
if(nread > 0)
{
nleft -= nread;
ptr += nread;
}
}

I tested it with the unmodified slip driver. Sending 4000 bytes would result
in the receiver getting 3000 bytes. The sender announces that the other 1000
bytes were sent as well, but nothing reaches the receiver, which just blocks
for these 1000 bytes.

How can one send arbitrary long data (even more than 64k) with UDP?

-Kamran Karimi