IP Datagrams - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

IP Datagrams

Description:

... is used to extract the network part of an address during lookup. 7 ... Each fragment contains of original datagram identification number fragment offset. ... – PowerPoint PPT presentation

Number of Views:62
Avg rating:3.0/5.0
Slides: 18
Provided by: alanbat
Category:

less

Transcript and Presenter's Notes

Title: IP Datagrams


1
IP Datagrams
  • Chapter 16,17

2
Connectionless service
  • Extension of packet switching
  • Individual packets can be transmitted across the
    internet.
  • Each packet travels independently and contains
    information that identifies the recipient.

3
The IP datagram
  • Datagram refers to an internet packet.
  • The amount of data carried is not fixed but
    varies from 1 octet to 64K octets including the
    header.
  • The datagram header contains information to route
    the datagram across the network.

4
Forwarding an IP Datagram
  • Each router along the path receives the datagram,
    extracts the destination address and uses it to
    determine the next hop to which the datagram
    should be sent.
  • Each IP router keeps information in a routing
    table.

Table found at R2
5
IP addresses Routing table entries
Specifies which bits of address correspond to the
network prefix
In practice routing is more complex
6
The Mask Field
  • The process of selecting the next hop is called
    routing.
  • The mask field is used to extract the network
    part of an address during lookup.

7
Best-Effort Delivery
  • IP does not guarantee that it will handle the
    problems of
  • Datagram duplication
  • Delayed or out-of-order delivery
  • Corruption of data
  • Datagram loss
  • IP datagrams may be lost, duplicated, delivered
    out of order or delivered with corrupted data.

8
Datagram header format
Each field has a fixed size
9
IP Encapsulation
10
MTU, Datagram size encapsulation
  • Each hardware technology specifies the maximum
    amount of data that a frame can carry. This limit
    is the MTU
  • MTU restrictions can cause a problem

Splitting datagram into fragments
11
Fragment Re-assembly
  • All fragments have the same destination address
    as original datagram. Final fragment identified
    with additional bit set in header.
  • Each fragment contains of original datagram
    identification number fragment offset.
  • Reassembled at final destination when all
    fragments have arrived.
  • IP specifies a maximum time to hold fragments.
  • Re-assembly is whole-or-nothing

12
Sending Datagrams in Java
  • Datagrams are up encapsulated using to two java
    classes
  • The DatagramSocket class
  • The DatagramPacket class

13
DatagramSocket Class
  • This class encapsulates a socket used for sending
    and receiving datagram packets. Since been
    routing Information is contained in the packets
    themselves, The constructors are not concerned
    with the destination for the data at all. You can
    create a datagram socket object with the default
    constructor
  • DatagramSocket socket new DatagramSocket()
  • To send a datagram you call the send() method for
    a the DatagramSocket, and pass the DatagramPacket
    object (which encapsulates the datagram ) to be
    sent as an argument.

14
Receiving a Datagram in Java
  • A socket used to receive a Datagram needs to have
    a specific fixed port address. Because the
    machine sending the data would have included the
    receiving port number as part of the packet
    header information. To create a receiving
    Datagram socket you can use the following
    constructor which takes an int parameter.
  • DatagramSocket receiver new DatagramSocket(portN
    umber)
  • To receive a datagram packet you call the
    DatagramSocket receive() method.

15
The DatagramPacket Class
  • The DatagramPacket class encapsulates a datagram
    packet. A datagram packet is an uninterpreted
    sequence of bytes therefore a byte array must be
    created containing the information you wish to
    send.
  • Two constructors are used
  • byte buffer new bytelength
  • DatagramPacket packetIn new DatagramPacket(buffe
    r,packetLength)
  • this is for packets used to receive data

16
DatagramPacket Class
  • DatagramPacket packetOut new datagramPacket(buff
    er, // byte
  • packetlength, // int
  • destination, //InetAddress
  • portNumber) // int
  • this is for sending packets of data
  • The portNumber is used to specify the process on
    the host.

17
Packet data
  • To obtain the data held in a packet call the
    getData() function.
  • byte data packet.getData()
  • To set the data in a packet call the setData()
    function.
  • packet.setData(newData)
Write a Comment
User Comments (0)
About PowerShow.com