Você está na página 1de 10

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M.

McDougall 2001

TCP/IP - Example

9/2000

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

TCP/IP Protocol Suite

Application
Transport
Internet
Data Link
Physical
9/2000

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

TCP/IP And OSI Model

9/2000

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

An Exchange Using the TCP Model

L5 data
L5 data H4
L4 data
T2

L3 data

H3
H2

01010101010110101

L5 data H4

L4 data

L5 data

T2

L3 data

H3
H2

01010101010110101

Transmission medium

9/2000

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

TCP/IP Model - An Example

The application being used is SMTP (electronic mail)


The message content is hi (ASCII - 68+69)
How this message flows through all the layers till it finally
reaches the destination.

9/2000

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

Application Layer

Application
Presentation

Application
Eg. SMTP - Email

Session

6869
Message
(2 bytes)

Local part@Domain name


Address of the
mailbox on the
local site

The domain name


of the destination

Message formatting, data compression, data encryption,


and synchronization of data exchange
9/2000

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

Transport Layer

User datagram
(22 bytes)

Transport

6869

TCP

UDP

2 bytes
TCP Header
(20 bytes)

End-to-end delivery of message, addressing service points,


reliable delivery, multiplexing
9/2000

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

TCP Header

- 6869
- 520

- 520

5H

9/2000

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

Network Layer

Datagram
(42 bytes)

Network

H
IP
IP header
(20 bytes)
User datagram
(22 bytes)

Source-to-destination delivery, addressing, address resolution

9/2000

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

IP Header

4H

5H

0026H

9594H
80H

0.0.0
11H
128.194.55.152
128.194.55.254

9/2000

10

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

Data Link & Physical Layer

Frame
(68 bytes)

Data link

T Datagram H

Protocols defined by the


underlying layer
Physical

Trailer Header
(4 bytes) (14 bytes)
10010101010001
Bits

Delivering data units, flow control, error detection, access control,


conversion of data bits into electric signals and transmission
9/2000

11

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

802.3 MAC Frame

Type

Destination address : 00:c0:02:16:67:36


Source address : 00:80:5f:57:a9:a8
Type : 0800H (IP)

9/2000

12

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

UDP: Example

9/2000

13

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

USER DATAGRAM PROTOCOL

Connectionless
Unreliable
Simple
Packet Oriented
Simple Application Interface

9/2000

14

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

UDP Frame
Source Port
(16 Bits)

Destination Port
(16 Bits)

Length
(16 Bits)
Length of Datagram

Checksum
(16 Bits)

Optional : 16 bit ones


complement sum of the
pseudo IP header, the
UDP Header and the
Data.

DATA

9/2000

15

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

PROTOCOLS USING UDP

SNMP
DNS
BOOTP
TFTP
SUNRPC
SNMPTRAP
NFS
RIP
GDP
BIFF
WHO
SYSLOG

9/2000

16

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

UDP FRAME CAPTURED


ADDR HEX ASCII
0000: 00 60 2f dd 1d 20 08 00 20 8f 9b 39 08 00 45 00 | .`/.. .. ..9..E.
0010: 00 48 7c 20 40 00 ff 11 b0 8e 82 bf a3 74 82 bf | .H| @........t..
0020: a6 02 a5 f2 00 35 00 34 f9 ba 4f 04 01 00 00 01 | .....5.4..O.....
0030: 00 00 00 00 00 00 01 32 03 31 36 36 03 31 39 31 | .......2.166.191
0040: 03 31 33 30 07 69 6e 2d 61 64 64 72 04 61 72 70 | .130.in-addr.arp
0050: 61 00 00 0c 00 01 | a..

UDP: ----- UDP Header ----UDP:


UDP: Source port = 42482
UDP: Destination port = 53 (Domain)
UDP: Length = 52
UDP: Checksum = F9BA (correct)
UDP: [44 byte(s) of data]
9/2000

17

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

UDP DATAGRAMS in JAVA


Applications that communicate via datagrams send and receive
completely independent packets of information. These clients and
servers do not have and do not need a dedicated point-to-point channel.
The delivery of datagrams to their destinations is not guaranteed. Nor
is the order of their arrival.
Definition: A datagram is an independent, self-contained message
sent over the network whose arrival, arrival time, and content are not
guaranteed.
The java.net package contains two classes to help you write Java
programs that use datagrams to send and receive packets over the
network: DatagramSocket, DatagramPacket, and MulticastSocket
An application can send and receive DatagramPackets through a
DatagramSocket. In addition, DatagramPackets can be broadcast to
multiple recipients all listening to a MulticastSocket.
9/2000

18

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

To Send Datagrams
int port;
InetAddress address;
DatagramSocket socket = null;
DatagramPacket packet;
byte[] sendBuf = new byte[256];

DatagramSocket socket = new DatagramSocket();

byte[] buf = new byte[256];


InetAddress address =
9/2000

19

Telecommunication Engineering Technology, Texas A&M University LAN WAN Lecture Notes - Copyright Jeff M. McDougall 2001

To Receive Datagrams
int port;
InetAddress address;
DatagramSocket socket = null;
DatagramPacket packet;
byte[] sendBuf = new byte[256];
DatagramSocket socket = new
DatagramSocket(port);

byte[] buf = new byte[256];


packet
= new DatagramPacket(buf, buf.length);
9/2000

20

socket.receive(packet);

10

Você também pode gostar