Programming Assignment 1

Similar documents
Programming Assignment 1

Programming Assignment 0

Programming Assignment 2

ECE 650 Systems Programming & Engineering. Spring 2018

CNT5505 Programming Assignment No. 4: Internet Packet Analyzer (This is an individual assignment. It must be implemented in C++ or C)

Assignment 1. Due date February 6, 2007 at 11pm. It must be submitted using submit command.

Program Assignment 2

Transport Protocol (IEX-TP)

CSCI 4210 Operating Systems CSCI 6140 Computer Operating Systems Homework 4 (document version 1.0) Network Programming using C

xkcd.com End To End Protocols End to End Protocols This section is about Process to Process communications.

Transport Layer. Gursharan Singh Tatla. Upendra Sharma. 1

User Datagram Protocol

COMP/ELEC 429/556 Project 2: Reliable File Transfer Protocol

CS 640 Introduction to Computer Networks Spring 2009

Lecture 20 Overview. Last Lecture. This Lecture. Next Lecture. Transport Control Protocol (1) Transport Control Protocol (2) Source: chapters 23, 24

6. The Transport Layer and protocols

Connections. Topics. Focus. Presentation Session. Application. Data Link. Transport. Physical. Network

Computer Communications and Networks (COMN), 2017/18, Semester 1

Transport Layer. <protocol, local-addr,local-port,foreign-addr,foreign-port> ϒ Client uses ephemeral ports /10 Joseph Cordina 2005

Simulation of TCP Layer

Your Name: Your student ID number:

TRANSMISSION CONTROL PROTOCOL. ETI 2506 TELECOMMUNICATION SYSTEMS Monday, 7 November 2016

Sequence Number. Acknowledgment Number. Data

Transport Layer. Application / Transport Interface. Transport Layer Services. Transport Layer Connections

II. Principles of Computer Communications Network and Transport Layer

CSC 401 Data and Computer Communications Networks

Assignment 1: Plz Tell Me My Password

Context. Distributed Systems: Sockets Programming. Alberto Bosio, Associate Professor UM Microelectronic Departement

Computer Networks A Simple Network Analyzer PART A undergraduates and graduates PART B graduate students only

Homework 1: Programming Component Routing Packets Within a Structured Peer-to-Peer (P2P) Network Overlay VERSION 1.1

EEC-682/782 Computer Networks I

05 Transmission Control Protocol (TCP)

Chapter 6. What happens at the Transport Layer? Services provided Transport protocols UDP TCP Flow control Congestion control

Distributed Systems Exam 1 Review. Paul Krzyzanowski. Rutgers University. Fall 2016

Figure 1: Graphical representation of a client-server application

Transport Protocols. ISO Defined Types of Network Service: rate and acceptable rate of signaled failures.

Transport Protocols. Raj Jain. Washington University in St. Louis

Transport Over IP. CSCI 690 Michael Hutt New York Institute of Technology

CIS 505: Software Systems

Transport Layer. The transport layer is responsible for the delivery of a message from one process to another. RSManiaol

QUIZ: Longest Matching Prefix

Lab Assignment 3 for ECE374

Chapter 7. The Transport Layer

CS457 Transport Protocols. CS 457 Fall 2014

UNIT V. Computer Networks [10MCA32] 1

ECE 358 Project 3 Encapsulation and Network Utilities

Programming Assignment 3: Transmission Control Protocol

Project Introduction

Network Element Configuration

TCP Service Model. Today s Lecture. TCP Support for Reliable Delivery. EE 122:TCP, Connection Setup, Reliability

CS 118 Project Phase 2 P2P Networking

MIB BROADCAST STREAM SPECIFICATION

UNIT 2 TRANSPORT LAYER

CSE 461 Connections. David Wetherall

CS4700/CS5700 Fundamentals of Computer Networks

Introduction to Networks and the Internet

UNIT IV -- TRANSPORT LAYER

Socket Programming. Sungkyunkwan University. Hyunseung Choo Copyright Networking Laboratory

CS344/444 Spring 2007 Project 1 Instant Messaging Client and Server

Overview. Setup and Preparation. Exercise 0: Four-way handshake

Computer Networks A Simple Network Analyzer Decoding Ethernet and IP headers

UDP and TCP. Introduction. So far we have studied some data link layer protocols such as PPP which are responsible for getting data

Final Programming Project

CS 450 Introduction to Networking Spring 2014 Homework Assignment 1 File Transfer and Data Bandwidth Analysis Tool

ICSI 516 Fall 2018 Project 1 Due October 26th at 11:59PM via Blackboard

6.1 Internet Transport Layer Architecture 6.2 UDP (User Datagram Protocol) 6.3 TCP (Transmission Control Protocol) 6. Transport Layer 6-1

The aim of this unit is to review the main concepts related to TCP and UDP transport protocols, as well as application protocols. These concepts are

CCNA 1 Chapter 7 v5.0 Exam Answers 2013

Connection-oriented (virtual circuit) Reliable Transfer Buffered Transfer Unstructured Stream Full Duplex Point-to-point Connection End-to-end service

CSCI 4210 Operating Systems CSCI 6140 Computer Operating Systems Homework 4 (document version 1.1) Sockets and Server Programming using C

Announcements Computer Networking. Outline. Transport Protocols. Transport introduction. Error recovery & flow control. Mid-semester grades

Mobile Transport Layer Lesson 02 TCP Data Stream and Data Delivery

CPSC156a: The Internet Co-Evolution of Technology and Society. Lecture 4: September 16, 2003 Internet Layers and the Web

7. TCP 최양희서울대학교컴퓨터공학부

CS 326: Operating Systems. Networking. Lecture 17

Networking Technologies and Applications

Announcements. No book chapter for this topic! Slides are posted online as usual Homework: Will be posted online Due 12/6

New York University Computer Science Department Courant Institute of Mathematical Sciences

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala. October 25, 2018

CSEP 561 Connections. David Wetherall

No book chapter for this topic! Slides are posted online as usual Homework: Will be posted online Due 12/6

COMPUTER NETWORK. Homework #2. Due Date: April 12, 2017 in class

CSE 461: Computer Networks John Zahorjan Justin Chan Rajalakshmi Nandkumar CJ Park

Expected Time: 90 min PART-A Max Marks: 42

Network Layer PREPARED BY AHMED ABDEL-RAOUF

ECE697AA Lecture 3. Today s lecture

Transport: How Applications Communicate

Project 3. Reliable Data Transfer over UDP. NTU CSIE Computer Networks 2011 Spring

ECE 435 Network Engineering Lecture 15

IPConfigure Embedded LPR API

ipv6 mobile home-agent (global configuration)

NWEN 243. Networked Applications. Layer 4 TCP and UDP

Overview. Exercise 0: Implementing a Client. Setup and Preparation

COMP/ELEC 429/556 Introduction to Computer Networks

Transport Protocols & TCP TCP

User Datagram Protocol (UDP):

CSE 461 Module 11. Connections

Guide To TCP/IP, Second Edition UDP Header Source Port Number (16 bits) IP HEADER Protocol Field = 17 Destination Port Number (16 bit) 15 16

ECE4110 Internetwork Programming. Introduction and Overview

CS UDP: User Datagram Protocol, Other Transports, Sockets. congestion worse);

Transcription:

CMSC 417 Computer Networks Fall 2017 Programming Assignment 1 Assigned: September 6 Due: September 14, 11:59:59 PM. 1 Description In this assignment, you will write a UDP client and server to run a simplified version of NTP (Network Time Protocol). In contrast to TCP, UDP provides fewer properties and guarantees on top of IP. As in TCP, UDP supports 2 16 ports that serve as communication endpoints on a given host (which is identified by the IP address). Unlike TCP, UDP is a connection-less protocol, meaning that a source can send data to a destination without first participating in a handshaking protocol. Additionally, UDP does not handle streams of data, but rather individual messages which are termed datagrams. Finally, UDP does not provide the following guarantees: 1) that datagrams will be delivered, 2) that the datagrams will be delivered in order, 3) that the datagrams will be delivered without duplicates. You can find information on the UDP socket API calls in the Donahoo/Calvert book. For more information on UDP, you can refer to Section 5.1 and the introduction to Section 5 in the Peterson/Davie book. 2 Protocol Figure 1: Example message sequence diagram for the assignment protocol. There are two dropped packets, and an out-of-order response. 1

The protocol you will implement resembles that of NTP and will use two types of messages: TimeRequests and TimeResponses. In this project, the packet payloads will include the time on the machine when the packet was sent. You will use clock gettime() to get the current time; that function writes the time into a timespec structure containing two 64-bit unsigned integers (the number of seconds and nanoseconds since the start of the epoch). These values will be referred to hereon as the time in seconds and the time in nanoseconds. Unlike the protocol in Assignment 0, there is no initialization. The client sends a TimeRequest that contains a sequence number for the request and a timestamp of when it sent the payload. Upon receiving the TimeRequest, the server replies with a TimeResponse that contains the same sequence number and timestamp in the TimeRequest, as well as a timestamp of when the server sends the TimeResponse. The formats of these messages are shown below. Client -> Server TimeRequest Ver Seq # Client Seconds Client Nanoseconds 1 2 8 8 Server -> Client TimeResponse Ver Seq # Client Seconds Client Nanoseconds 1 2 8 8 Server Seconds Server Nanoseconds 8 8 Figure 2: Message formats TimeRequest (Client Server) 1. Version: A one-byte integer set to the value 1. 2. Sequence Number: A two-byte integer in network byte order that identifies the ordering of requests sent from the client. 3. Client Seconds: An eight-byte integer in network byte order representing the time in seconds when the client sent the TimeRequest. 4. Client Nanoseconds: An eight-byte integer in network byte order representing the time in nanoseconds when the client sent the TimeRequest. TimeResponse (Server Client) 1. Version: A one-byte integer set to the value 1. 2. Sequence Number: A two-byte integer in network byte order that is identical to the sequence number sent from the client s TimeRequest. 3. Client Seconds: An eight-byte integer in network byte order representing the time in seconds when the client sent the TimeRequest. 4. Client Nanoseconds: An eight-byte integer in network byte order representing the time in nanoseconds when the client sent the TimeRequest. 5. Server Seconds: An eight-byte integer in network byte order representing the time in seconds when the server sent the TimeResponse. 6. Server Nanoseconds: An eight-byte integer in network byte order representing the time in nanoseconds when the server sent the TimeResponse. 2

3 Server Implementation The server is a command-line utility taking the following arguments: 1. -p <Number> = Port that the server binds to and listens on. Represented as a base-10 integer. Must be specified, with a value > 1024. 2. -d <Number> = Percentage chance that the server drops any given UDP payload that it receives. Represented as a base-10 integer. This parameter is optional, but if included, must have a value in [0, 100]. (A 0 value means that the server does not purposefully ignore any packets, and a value of 100 means that the server ignores all packets.) Omitting this flag means that the server does not drop any packets. An example usage is as follows:./server -p 41717 -d 15 The server binds to the UDP port specified by the command-line argument and receives incoming TimeRequests. Upon receiving a payload, the server does the following: 1. Randomly keeps or ignores the payload. The probability of dropping the payload is specified in the command-line arguments. 2. If the payload is not ignored, takes a timestamp using clock gettime. 3. If the current sequence number of the payload is lower than the highest observed sequence number for that client, prints out the current TimeRequest s sequence number and the highest observed sequence number for that client. The format of the print statement should be the address and port of the client, separated by a colon, followed by the current sequence number and the highest observed sequence number for that client, all separated by spaces. <ADDR>:<Port> <SEQ> <MAX> If the highest sequence number for a given client has not changed for two minutes, the server clears the highest observed sequence number for that client, and treats the next (if any) TimeRequest from that same client as the new highest sequence number for that client. 4. Crafts and sends the TimeResponse payload back to the sender of the TimeRequest. The TimeResponse is a single datagram. The sequence number and client timestamp are the same as the corresponding TimeRequest. The server time is the timestamp the server just took. 4 Client Implementation The client is a command-line utility taking the following arguments: 1. -a <String> = The IP address of the server, represented as an ASCII string (e.g., 128.8.126.63). Must be specified. 2. -p <Number> = The port that the server is bound listening on. Represented as a base-10 integer. Must be specified. 3

3. -n <Number> = The number of TimeRequests (N) that the client will send to the server, represented as a base-10 integer. Must be specified, and have a value 0. 4. -t <Number> = Timout. The time in seconds (T) that the client will wait after sending its last TimeRequest to receive a TimeResponse. The timeout resets on each TimeResponse that the client receives. Must be specified. A value of 0 indicates the client does not have a timeout and thus will wait indefinitely for dropped TimeResponses. An example usage is as follows:./client -a 128.8.126.63 -p 41717 -n 100 -t 5 Sending TimeRequests As specified by the command-line arguments, the client sends N TimeRequest UDP payloads (each TimeRequest is a single UDP datagram). For each TimeRequest the client sends, the client: 1. Determines the current sequence number. The first TimeRequest the client sends has sequence number 1, the second has sequence number 2, and so on. 2. Takes the current time, using clock gettime. 3. Crafts and sends the TimeRequest payload by including the sequence number and the timestamp. Receiving TimeResponses The client calculates the differences of timestamps upon receiving a TimeResponse. For each TimeResponse the client receives, the client: 1. Takes the current time using clock gettime. We refer to this timestamp as T 2. 2. Retrieves the original client timestamp and the timestamp generated by the server from the TimeResponse payload. We refer to the original client timestamp as T 0 and the server timestamp as T 1. 3. Computes the time offset (θ) and round-trip delay (δ) for the given sequence number as: θ = (T 1 T 0 ) + (T 1 T 2 ) 2 δ = T 2 T 0 Client Output The client sends all N TimeRequests. When the client has sent the N th TimeRequest, the client starts keeping track of how long it takes to receive a TimeResponse. If the client receives a TimeResponse within the timeout, the client resets the timeout, and tries to receive another response within the timeout, and so on. This process continues until either all TimeResponses are received, or a timeout occurs whichever happens first. The client then outputs N lines coresponding to the N TimeRequests, printed in ascending order of sequence number, and exits. For a TimeRequest that received a TimeResponse, the output line is: <SEQ>: <THETA> <DELTA> 4

where SEQ is a decimal value and T HET A and DELT A are in seconds printed to four decimal places. For a TimeRequest that did not receive a TimeResponse, the output line is: An example output when N=4 is: 1: -0.0555 0.5551 2: Dropped 3: 0.1055 1.1230 4: Dropped 5 Grading <SEQ>: Dropped Your project grade will depend on the parts of the project that you implement. Each letter grade also depends on successful completion of the parts mentioned for all lower letter grades. Assuming each part has a good implementation, the grades are as follows: Grade C B A Parts Completed Protocol completes using UDP when there are no errors Handle dropped and out-of-order packets with 1 Client Handle dropped and out-of-order packets with >1 Clients 6 Additional Requirements 1. Your code must be submitted as a series of commits that are pushed to the origin/master branch of your Git repository. We consider your latest commit prior to the due date/time to represent your submission. 2. The directory for your project must be called assignment1 and be located at the root of your Git repository. 3. You must provide a Makefile that is included along with the code that you commit. We will run make inside the assignment1 directory, which must produce two binaries server and client also located in the assignment1 directory. 4. You must submit code that compiles in the provided VM, otherwise your assignment will not be graded. 5. Your code must be -Wall clean on gcc/g++ in the provided VM, otherwise your assignment will not be graded. Do not ask the TA for help on (or post to the forum) code that is not -Wall clean, unless getting rid of the warning is the actual problem. 6. You are not allowed to work in teams or to copy code from any source. 5