Networking: UDP & DNS

[Pages:31]?

Computer Systems and Networks

ECPE 170 ? Jeff Shafer ? University of the Pacific

Networking: UDP & DNS

Activities

? This Week

? Lab 9 ? Network Programming

? Next Week

? Start Assembly Programming (lecture for 1+ day)

Computer Systems and Networks

2

Lab Schedule

Assignments Due

? Lab 9

? Due by Apr 4th 5:00am

Spring 2017

3

?

User Datagram Protocol (UDP)

Computer Systems and Networks

Spring 2017

4

UDP versus TCP

Reliable?

Connectionoriented?

Programming model?

Applications

TCP Yes (Via acknowledgements and retransmitting)

Yes (Server has one socket per client)

Stream (continuous flow of data ? may get a little bit at a time)

UDP No

No (Server has one socket and all messages from all clients are received on it) Datagram (data is sent in its entirety or not at all. Size of each datagram is small)

HTTP (Lab 8) Web, email, file transfer

DNS (Lab 9) Streaming Audio/Video, Gaming

Computer Systems and Networks

Spring 2017

5

User Datagram Protocol (UDP)

? UDP: no "connection" between client and server

? No handshaking

? Sender explicitly attaches IP address and port of destination to each message

? Receiver can extract IP address, port of sender from received datagram

application viewpoint

UDP provides unreliable transfer of groups of bytes ("datagrams")

between client and server

Computer Systems and Networks

Spring 2017

6

User Datagram Protocol (UDP)

? Each UDP message is self-contained and complete

? Each time you read from a UDP socket, you get a complete message as sent by the sender

? That is, assuming it wasn't lost in transit!

? Think of UDP sockets as putting a stamp on a letter and sticking it in the mail

? No need to establish a connection first ? Receiver has no idea "letter" is arriving until they

look in the mailbox

Computer Systems and Networks

Spring 2017

7

Python UDP Programming

? Two new functions: sendto() and recvfrom()

server_ip = 1.2.3.4 port = 5678 dest_addr = (server_ip, port) s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) ... ... bytes_sent = s.sendto(raw_bytes, dest_addr) ... ... max_bytes = 4096 (raw_bytes, src_addr) = s.recvfrom(max_bytes)

Computer Systems and Networks

Spring 2017

8

Domain Name System (DNS)

Computer Systems and Networks

?

Spring 2017

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download