You use the Java classes DatagramPacket and DatagramSocket.
|IP Packet Header|
|Field||Size in bits||Purpose|
|source IP||32||Not in the UDP header, but rather in the basic IP header. Who sent the packet. When it finally arrives at its destination the receiver will know who it was from.|
|destination IP||32||Not in the UDP header, but rather in the basic IP 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 IP 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 IP 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 IP 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.
IP 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 IP datagram, which is broken into as many fragments as needed by the link layer at each link along the route.
Neither IP nor UDP support retransmission. A dropped or damaged fragment will cause the entire IP datagram, and consequently the UDP datagram, to be dropped. UDP does support reassembly of the datagram, however, through the underlying IP 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:[18.104.22.168]
You are visitor number|