Programming Assignment 1

Similar documents
Programming Assignment 1

Programming Assignment 0

Programming Assignment 2

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.

ECE 650 Systems Programming & Engineering. Spring 2018

Transport Protocol (IEX-TP)

CS 640 Introduction to Computer Networks Spring 2009

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

Your Name: Your student ID number:

Program Assignment 2

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

User Datagram Protocol

Transport Layer. Gursharan Singh Tatla. Upendra Sharma. 1

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

Lab Assignment 3 for ECE374

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

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

05 Transmission Control Protocol (TCP)

EEC-682/782 Computer Networks I

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

Programming Assignment 3: Transmission Control Protocol

Sequence Number. Acknowledgment Number. Data

Figure 1: Graphical representation of a client-server application

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

II. Principles of Computer Communications Network and Transport Layer

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

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

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

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

CSC 401 Data and Computer Communications Networks

QUIZ: Longest Matching Prefix

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

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

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

ECE 358 Project 3 Encapsulation and Network Utilities

Simulation of TCP Layer

6. The Transport Layer and protocols

Assignment 1: Plz Tell Me My Password

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

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

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

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

CS 118 Project Phase 2 P2P Networking

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

Project Introduction

Network Element Configuration

3 Threadsafe Bounded List Wrapper Library Monitor

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

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

UNIT IV -- TRANSPORT LAYER

Introduction to Networks and the Internet

CS4700/CS5700 Fundamentals of Computer Networks

Final Programming Project

Computer Networks A Simple Network Analyzer Decoding Ethernet and IP headers

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

Mobile Transport Layer Lesson 02 TCP Data Stream and Data Delivery

Mobile Transport Layer Lesson 10 Timeout Freezing, Selective Retransmission, Transaction Oriented TCP and Explicit Notification Methods

CS 326: Operating Systems. Networking. Lecture 17

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

Overview. Last Lecture. This Lecture. Daemon processes and advanced I/O functions

COMS3200/7201 Computer Networks 1 (Version 1.0)

DISTRIBUTED NETWORK COMMUNICATION FOR AN OLFACTORY ROBOT ABSTRACT

Socket Programming Assignment 6: Video Streaming with RTSP and RTP

CCNA 1 Chapter 7 v5.0 Exam Answers 2013

General Instructions. You can use QtSpim simulator to work on these assignments.

New York University Computer Science Department Courant Institute of Mathematical Sciences

Network Layer PREPARED BY AHMED ABDEL-RAOUF

ECE697AA Lecture 3. Today s lecture

CSEP 561 Connections. David Wetherall

MESSAGES error-reporting messages and query messages. problems processes IP packet specific information

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

ECE4110 Internetwork Programming. Introduction and Overview

IPConfigure Embedded LPR API

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

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

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

NWEN 243. Networked Applications. Layer 4 TCP and UDP

Examination 2D1392 Protocols and Principles of the Internet 2G1305 Internetworking 2G1507 Kommunikationssystem, fk SOLUTIONS

CS 344/444 Spring 2008 Project 2 A simple P2P file sharing system April 3, 2008 V0.2

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

Version 2.1 User Guide 08/2003

Applied Networks & Security

CSE 461 Connections. David Wetherall

Japannext PTS GLIMPSE Market Data Specification for Equities

ECE 461 Internetworking Fall Quiz 1

CS457 Transport Protocols. CS 457 Fall 2014

Socket Programming. Sungkyunkwan University. Hyunseung Choo Copyright Networking Laboratory

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

Some slides courtesy David Wetherall. Communications Software. Lecture 4: Connections and Flow Control. CSE 123b. Spring 2003.

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

Last Class: RPCs and RMI. Today: Communication Issues

Remote Invocation. Today. Next time. l Overlay networks and P2P. l Request-reply, RPC, RMI

Kent State University

EEC-484/584 Computer Networks. Lecture 16. Wenbing Zhao

Transport Layer (TCP/UDP)

Motivation of VPN! Overview! VPN addressing and routing! Two basic techniques for VPN! ! How to guarantee privacy of network traffic?!

Unix Network Programming

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

IT 341: Introduction to System

Transcription:

CMSC 417 Computer Networks Spring 2017 Programming Assignment 1 Assigned: February 3 Due: February 10, 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 contents of the packets 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 will reply with a TimeResponse that contains the sequence number it received, the timestamp that it received with client s payload, and the timestamp of when it sends the TimeResponse. The formats of these messages are shown below. TimeRequest (Client Server) 1. ID: A two-byte integer in network byte order that is set to the value 0x417. 2. Sequence Number: A four-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. ID: A two-byte integer in network byte order that is set to the value 0x417. 2. Sequence Number: A four-byte integer in network byte order that should be 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. 3 Server Implementation The server will be a command line utility, which takes the following arguments: 1. -p <Number> = Port that the server will bind to and listen on. Represented as a base-10 integer. Must be specified, with a value > 1024. 2

Figure 2: Example message sequence diagram for the assignment protocol. There are two dropped packets, and an out of order response. 2. -d <Number> = Percentage chance that the server will drop 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 will not purposefully ignore any packets, and a value of 100 means that the server will ignore all packets.) Omitting this flag means that the server will not drop any packets. An example usage is as follows:./server -p 41717 -d 15 The server will bind to the UDP port specified by the command line arguments and receive incoming TimeRequests. Upon receiving a payload, the server will do the following: 1. Randomly keep or ignore the payload. The probability of dropping the payload is specified in the command line arguments. 2. If the payload is not ignored, take a timestamp using clock gettime. 3. If the current sequence number of the payload is lower than the highest observed sequence number from the current client, print out highest observed sequence number and the current sequence number. 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 the client, all separated by spaces. <ADDR>:<Port> <SEQ> <MAX> If the maximum sequence number for a given client has not changed for 10 minutes, the server should clear its cache for that client, removing the recorded sequence number. 4. Craft and send the TimeResponse payload back to the sender of the TimeRequest. The sequence number and client timestamp should be the same as the corresponding TimeRequest. The server time should be using the time stamp that the server just took. 4 Client Implementation The client will be a command line utility, which takes the following arguments: 1. -a <String> = The IP address of the machine that the server is running on. Represented as a 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> = The time in seconds (T) that the client will wait after sending a TimeRequest or receiving a TimeResponse before terminating. Must be specified. A value of 0 will make the client not have a timeout, meaning it will wait indefinitely for dropped TimeResponses. An example usage is as follows:./client -a 128.8.126.63 -p 41717 -n 100 -t 5 After parsing in the arguments, the client will have two tasks: sending all TimeRequests and reporting on the received time data. Sending TimeRequests As specified by the command line arguments, the client will send N TimeRequest UDP payloads. For each payload the client will send, it specifically does the following: 1. Determine the current sequence number. The sequence number is simply K, where K is the Kth TimeRequest you are sending out. For instance, the first TimeRequest you send out will have sequence number 1, and so on. 2. Take the current time, using clock gettime. 3. Craft and send the TimeRequest payload by including the sequence number and the timestamp. Receiving TimeResponses The client will need to to calculate the differences of timestamps upon receiving a TimeResponse. For each TimeResponse the client receives, it should do as follows: 1. Take the current time using clock gettime. We will refer to this timestamp as T 2. 2. Retrieve the original client timestamp and the timestamp generated by the server from the TimeResponse payload. We will refer to the original client timestamp as T 0 and the server timestamp as T 1. 3. Compute the time offset and round trip delay for the TimeRequest and TimeResponse change for the given sequence number. The time offset θ for the sequence is defined as and the round trip delay δ is defined below. θ = (T 1 T 0 ) + (T 1 T 2 ) 2 δ = T 2 T 0 After computing the data, print the data for the given sequence as specified in the section below. 4

Reporting NTP Data The client will need to print out the time offset and round trip delay for each TimeResponse it receives. The client should terminate immediately after receiving all TimeResponses and printing them. In the case that the client does not receive all TimeResponses within T seconds of sending all of its TimeRequests or receiving its most recent TimeResponse, the client should print out the sequence numbers of all the TimeRequests that did not get a TimeResponse. For each sequence, the print statement should be the sequence number, the time offset, and the round trip delay. The sequence number and the time offset are separated by a colon and a space, and the time offset and round trip delay are separated by a space. Each sequence s print statement should be on its own line. Below is the general format of the print statement. <SEQ>: <THETA> <DELTA> All of these values (except sequence number) should be printed to four decimal places. If the client did not receive any responses within T seconds of its last response (or its last TimeRequest), it should print out all of the sequences in order, using the following format: 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. 5

6. You are not allowed to work in teams or to copy code from any source. 6