You use the Java classes DatagramPacket and DatagramSocket.
|IPs Packet Header|
|Field||Size in bits||Purpose|
|source IPs||32||Not in the UDP header, but rather in the basic IPs header. Who sent the packet. When it finally arrives at its destination the receiver will know who it was from.|
|destination IPs||32||Not in the UDP header, but rather in the basic IPs header. Where the packet is going. On each leg of its journey the routing computer uses this to get the packet a little closer to its final destination.|
|checksum||16||This is computed as the 16-bit one’s complement of the one’s complement sum of a pseudo header of information from the IPs header, the UDP header, and the data, padded as needed with zero bytes at the end to make a multiple of two bytes. If the checksum is set to zero, then checksumming is disabled. If the computed checksum is zero, then this field must be set to 0xFFFF.|
|source port||16||Similar to the function the source port in TCP/IP. It is a free port on the sender’s machine where any responses should be sent.|
|destination port||16||Which program on the server this should be directed to.|
|message length||16||total size of UDP header plus data payload (but not the IPs header) in 8-bit chunks (aka bytes or octets). The means the maximum size of a packet including data is 64K. This means the payload of data is at most 65,451 bytes. This could have easily been calculated from the length in the IPs packet header, but for some reason they duplicated the information.|
Everything is in big endian byte order. See details.
Ethernet frames cannot carry more than 1,500 bytes of payload. So when a UDP packet is transported over an Ethernet LAN (Local Area Network), it may take several Ethernet packets to do it.
IPs datagrams larger than the MTU (Maximum Transmission Unit) of the link layer are fragmented and sent in multiple link data units (packets).
UDP datagrams can be up to 65535 bytes long (header + payload). Each UDP datagram maps onto one IPs datagram, which is broken into as many fragments as needed by the link layer at each link along the route.
Neither IPs nor UDP support retransmission. A dropped or damaged fragment will cause the entire IPs datagram, and consequently the UDP datagram, to be dropped. UDP does support reassembly of the datagram, however, through the underlying IPs datagram support.
In IPv6, it is possible to have jumbograms, datagrams with more than 65,535 bytes.
You use UDP instead of TCP/IP when:
|recommend book⇒Internetworking with TCP/IP Vol.1: Principles, Protocols, and Architecture, fourth edition|
|by||Douglas E. Comer||978-0-13-470188-2||paperback|
|How IP, UDP and TCP/IP protocols work. How the domain name to IP translation DNS information in propagated.|
|Greyed out stores probably do not have the item in stock. Try looking for it with a bookfinder.|
This page is posted
Optional Replicator mirror
Your face IP:[220.127.116.11]
You are visitor number|