Are there any restrictions on sending UDP datagrams over the network? For example, I want to send datagrams of up to 10,000 bytes to the server every 2ms. What restrictions on the part of the server and the Internet provider can be expected in this case?
Asked
Active
Viewed 32 times
0
-
*"up to 10,000 bytes to the server every 2ms"* - first of course you need to have the bandwidth, which with this spec would be at minimum 40 MBit/s. Then you'll run into trouble because of the size of the datagrams - see [What is the largest Safe UDP Packet Size on the Internet](https://stackoverflow.com/questions/1098897/what-is-the-largest-safe-udp-packet-size-on-the-internet). – Steffen Ullrich Apr 09 '22 at 11:08
-
Thank you. Is it client bandwidth? If so, as far as I understand, the server should have a similar bandwidth? – Joseph Conrad Apr 09 '22 at 11:42
-
Assuming that the client should not only send the datagrams but the server should also receive the datagrams, the server of course needs to have the necessary bandwidth too. And of course every link in between client and server. – Steffen Ullrich Apr 09 '22 at 12:32
-
Thank you so much. Sorry, what happens to the data if the bandwidth limit is exceeded? Will the "extra" datagrams be discarded or placed in the socket buffer for further sending? – Joseph Conrad Apr 09 '22 at 13:32
-
UDP is fire and forget. There are no guarantees associated with the protocol, i.e. datagrams can be lost, duplicated or reordered. There is no builtin feedback if packets arrived at the peer. A bit of buffering might be done at intermediate hops (i.e. routers) but too much buffering would actually cause problems for latency. – Steffen Ullrich Apr 09 '22 at 13:51
-
Do I understand correctly that data from the socket buffer on the computer is transferred to the router gradually, as the router can accept it? – Joseph Conrad Apr 09 '22 at 14:34
-
You _will_ lose packets across the Internet, so if you need to receive everything, in order, you need an application-layer protocol to number the data and request missing data be resent. This really sound like a job for TCP, which can take a, arbitrarily large stream of data, segment it, guarantee delivery, and reorder data before presenting it to the application. Also, 2 ms can only realistically be done on the local network. – Ron Maupin Apr 09 '22 at 14:43
-
@JosephConrad: *"Do I understand correctly that data from the socket buffer on the computer is transferred to the router gradually, as the router can accept it? "* - No. There is no such thing as "router can accept it". – Steffen Ullrich Apr 09 '22 at 14:56
-
@RonMaupin yes, but in my case sequence is not important – Joseph Conrad Apr 09 '22 at 15:10
-
@SteffenUllrich Does this mean that the bandwidth control is outside the router, that is, at the provider, which will probably (maybe) buffer data that has exceeded the limit? And the router, in turn, simply sends the data to the provider, not paying attention to the bandwidth? – Joseph Conrad Apr 09 '22 at 15:11
-
@JosephConrad: There is no bandwidth control at all. If packets arrive faster in the router than they can be transmitted they will simply be discarded. The ISP will not buffer any packets either. TCP handles this by getting feedback when packets arrived at the peer and thus can slow down if too much packets got lost. UDP does not care about packet loss. – Steffen Ullrich Apr 09 '22 at 15:22
-
@SteffenUllrich Then on what basis does the router receive data? For example, I added a datagram to the socket buffer. It turns out that this datagram, without taking into account any details, is immediately transmitted to the router (taking into account the busyness of the OS)? – Joseph Conrad Apr 09 '22 at 15:36
-
@JosephConrad: The packet is sent on the network link. If it makes it to the router (link has limited capacity) and if the router is fast enough to read it from the network interface then it will compute the outgoing interface and send it there to the next router via another link. If the capacity of the link layer is exceeded or if the router is not fast enough then packets get lost. Just imagine a street system without traffic jam - instead of traffic slowing down cars will simply be removed from the street and discarded. – Steffen Ullrich Apr 09 '22 at 15:50
-
@SteffenUllrich OK, thank you so much! The operating system sends the packet to the link. But at what point does the OS do it? Are these implementation details of the OS or is there a special well-known algorithm, according to which the OS understands that it's time to send the next data to the link? Just wondering what "router is fast enough" means? Does the router have its own separate bandwidth, different from the bandwidth of the link? – Joseph Conrad Apr 09 '22 at 16:34
-
@JosephConrad: The OS sends the data as soon as it can - or maybe even discards the data locally if the application is sending the data faster than the OS can put it on the link. As for the router - what it can do is limited by the properties of its network interfaces and attached links and by the performance of its CPU. – Steffen Ullrich Apr 09 '22 at 18:38