Homework 3 CSC/ECE , Fall, 2016

Similar documents
Homework 3 CSC , Spring, 2016

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

Intro to OpenFlow Tutorial

Intro to OpenFlow Tutorial

Virtual University of Pakistan. Describe the Hidden Node and Exposed Node problems in Standard? VUSR. [Larry L. Peterson]

ECE264 Fall 2013 Exam 3, November 20, 2013

EL2310 Scientific Programming

Introduction to computer networking

COMP/ELEC 429/556 Fall 2017 Homework #1

Programming Standards: You must conform to good programming/documentation standards. Some specifics:

Figure 1: Graphical representation of a client-server application

Fall CSEE W4119 Computer Networks Programming Assignment 1 - Simple Online Bidding System

New York University Computer Science Department Courant Institute of Mathematical Sciences

Web Mechanisms. Draft: 2/23/13 6:54 PM 2013 Christopher Vickery

Project 1: Snowcast Due: 11:59 PM, Sep 22, 2016

CPSC 4240/6240 Spring 2017 HW # 3 v1 Last update: 3/22/2017

P2P Programming Assignment

Programming Assignment

Lab Zero: A First Experiment Using GENI and Jacks Tool

ECE 461 Internetworking Fall Quiz 1

COMP90015: Distributed Systems Assignment 1 Multi-threaded Dictionary Server (15 marks)

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

Section 1 Short Answer Questions

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

CS 202, Fall 2017 Homework #4 Balanced Search Trees and Hashing Due Date: December 18, 2017

CSE 123: Computer Networks Fall Quarter, 2017 MIDTERM EXAM

Programming Assignment 3

MP 1: HTTP Client + Server Due: Friday, Feb 9th, 11:59pm

Lab Zero: A First Experiment Using GENI and Jacks Tool

Lab Exercise Sheet 3

CS 118 Project Phase 2 P2P Networking

CS155: Computer Security Spring Project #1

C18: Network Fundamentals and Reliable Sockets

GENI Tutorial with tmix Derek O'Neill UNC Chapel Hill

The TCP Protocol Stack

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

Project 1: Remote Method Invocation CSE 291 Spring 2016

External Data Representation (XDR)

false, import, new 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4

IP Addressing, monitoring and packet analyzing

Practical Session #09 Exceptions & Networking. Tom Mahler

Network Test and Monitoring Tools

Networking By: Vince

CSEE 4119: Computer Networks, Spring 2014

Lab 3: Simple Firewall using OpenFlow

CS395/495 Computer Security Project #2

Genie Routing lab. Laboration in data communications GenieLab Department of Information Technology, Uppsala University. Overview

Reliable File Transfer

CSCI4211: Introduction to Computer Networks Fall 2017 Homework Assignment 1

TCP/IP Network Essentials


,879 B FAT #1 FAT #2 root directory data. Figure 1: Disk layout for a 1.44 Mb DOS diskette. B is the boot sector.

Practical Exercises in Computer Networks

PostgreSQL Database and C++ Interface (and Midterm Topics) ECE 650 Systems Programming & Engineering Duke University, Spring 2018

Chapter Summaries and Reading

OpenFlow Firewall and NAT Devices

: Distributed Systems Principles and Paradigms Assignment 1 Multithreaded Dictionary Server

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

CPSC 3600 HW #4 Solutions Fall 2017 Last update: 12/10/2017 Please work together with your project group (3 members)

Lab Assignment 3 for ECE374

Assignment 3: Binary numbers, data types and C Programs Due 11:59pm Monday 26th March 2018

ECE 435 Network Engineering Lecture 2

1/18/13. Network+ Guide to Networks 5 th Edition. Objectives. Chapter 10 In-Depth TCP/IP Networking

Project #4: Implementing NFS

Applied Networks & Security

Switch Configuration message sent 1 (1, 0, 1) 2

false, import, new 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4

Lab 2: Threads and Processes

IP Basics Unix/IP Preparation Course June 29, 2010 Pago Pago, American Samoa

Internetworking April 13, 2006

ACT-R RPC Interface Documentation. Working Draft Dan Bothell

Homework 2: Programming Component SCALABLE SERVER DESIGN: USING THREAD POOLS TO MANAGE AND LOAD BALANCE ACTIVE NETWORK

Choice 1: audio, a simple audio client server system

IP Routing Volume Organization

Chapter 3 - Implement an IP Addressing Scheme and IP Services to Meet Network Requirements for a Small Branch Office

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences

CS 126 Lecture S5: Networking

CS 126 Lecture S5: Networking

Unit 5: Distributed, Real-Time, and Multimedia Systems

Table of Contents 1 Static Routing Configuration 1-1

The Interconnection Structure of. The Internet. EECC694 - Shaaban

Computer Networks CS3516 B Term, 2013

COMS3200/7201 Computer Networks 1 (Version 1.0)

Firewall Evasion Lab: Bypassing Firewalls using VPN

Network Programming in Python. based on Chun, chapter 2; plus material on classes

CS3114 (Fall 2013) PROGRAMMING ASSIGNMENT #2 Due Tuesday, October 11:00 PM for 100 points Due Monday, October 11:00 PM for 10 point bonus

1 Connectionless Routing

Your Name: Your student ID number:

COSC 6377 Mid-Term #2 Fall 2000

INF3190 Mandatory Assignment:

false, import, new 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4

The Specification of Project-1

Programming Assignment 1

BSc. (Hons) Web Technologies. Examinations for 2017 / Semester 1

3. When you process a largest recent earthquake query, you should print out:

Exercises: Basics of Network Layer Experiential Learning Workshop

Operation Manual IP Addressing and IP Performance H3C S5500-SI Series Ethernet Switches. Table of Contents

Top-Down Network Design

EECS122 Communications Networks Socket Programming. Jörn Altmann

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

Transcription:

Homework 3 CSC/ECE 573-001, Fall, 2016 Every question requires response in one or more of the following ways. If the question, in part or whole, requires textual response, include your response to it in an electronic document. Submit a single electronic document (text or PDF) for a homework, in accordance with rules detailed on the course website. For a question that also requires coding, you must also submit your code and build instructions in a single zip file, again refer to the course website for instructions. You may submit one zip file per such question, or zip them all into one file, but in the latter case you must make subdirectories for the different questions. If a question requires programming multiple modules or programs (for example, to run on different computers), in your zip file for that program, the source and build instructions for these should be clearly separated into directories, and an overall README file should provide information as to which modules should be run on what environment. For example, Q6 below asks you to specify the description of a protocol implemented by supplied programs, and also to recode them to specs. The answers to the questions should go into the single PDF or text file you submit, together with answers to other questions. The code with build instructions should go into a zip file. Submit the PDF/text and zipfile(s) to the WolfWare locker. Some of the questions may refer to library and system calls on Linux systems. You must obtain the answers by looking up reference information on actual programming platforms, such as man pages and -- help options. The platform must be a VCL platform; for each answer, you must include specific information (what VCL image, if it is VCL; what OS and version, if some other platform) about the platform it applies to. For Q5 Q8, you must use some Linux platform available on VCL that allows you to both program using Java and C/C++. VCL provides images that are appropriate platforms for the socket programming exercises. In particular, using a Ubuntu 14.04 base image should work (you may have to run sudo aptget update and sudo apt-get install openjdk-7-jdk first). You must still include information about the platform as above. 1. (Ungraded) Follow the entire process specified in the How-to OPNET document on the course website. (While this exercise is not graded, future homeworks will included graded OPNET exercises that will require you to have the background that the current exercise will provide. 2. What is the meaning of the third parameter (length) for the C library socket call send()? 3. What is the difference between the Java classes Socket and ServerSocket? Does C provide library functions to cover the functionality of both of these classes? If so, how? 4. What is the meaning of the second parameter (backlog) for the C library socket call listen()? How does the Java package java.net provide the functionality equivalent to listen()? How does Python?

5. This and the next few questions refer to the UDP and TCP client and server sample programs in C and Java that have been posted on the website. Make sure you can compile and run the programs on your VCL platform of choice. All the clients have the same behavior: read a line of text from the command line, send it to the server, and display whatever the server sends back. While the clients and servers on the same protocol written in the same programming language are matched, the servers all provide slightly different services, and have different behavior. State, in a single sentence each, what each server does. 6. As we can verify by trying to run the various clients and servers mis-matched against each other, they do not all implement the same application protocol, and therefore do not work successfully with each other. (a) For each server, describe the application protocol it implements. This should include what it expects in terms of format and content for the data incoming from the client, and similarly its reply. Your description should be brief, but sufficiently precise that it should be possible to use it as a standard to code a client that can successfully interact with each server. (b) Recode the original UDP server written in C to implement the same application layer protocol as the original UDP server written in Java. Validate the operation by running the original UDP Client written in Java against both the original Java server and your modified C server, and verifying that the behavior observed by the client is indistinguishable. (c) Recode the original UDP client written in Java to implement the same application layer protocol as the original UDP client written in C. Validate the operation by running both the original C client and your modified Java client against the original C server, and verifying that the behavior is indistinguishable. 7. The stream orientation of TCP can create pitfalls for applications if the application protocol fails to take note of the fact that TCP may send data in whatever units it deems appropriate, irrespective of how much the application writes into the socket at a time. Since all the programs are based on the client reading a single line of input from the user, and sending it to the server, it is reasonable to assume that the entire application PDU consists of a single NULL-terminated string (i.e. a string of bytes, each of which other than the last encodes an ASCII or UNICODE character, and the last byte has the value zero). But TCP may not send this entire string in one TCP PDU. Of the sample TCP programs supplied, some sidestep this issue by handing over the task of reading to and writing from a socket to some string handling class, and using matched calls to such classes on both the client and server. This is brittle, since it makes it difficult or impossible to program a client or server compliant to this standard using a platform or language on which that precise class is unavailable. The application programmer, when using such a call, may not be aware whether the function call automatically adds a null character at the end of a string or not, or a newline character, or a carriage-return/linefeed.

Others among the sample programs simply assume that the entire application PDU will be in a single TCP packet. This is plain wrong, since TCP s behavior cannot be controlled in this respect. (a) Among the sample TCP programs, which ones, if any, result in NOT sending a NULL character terminating the string? (b) Which ones, if any, make the error of assuming a single TCP socket read will suffice? (c) Which ones, if any, correctly incorporate the application protocol? (d) Recode all the programs that either sidestep or are erroneous so that they correctly implement the application protocol. 8. Develop a program or multiple programs that allow you to send packets to servers running on specific hosts, then use them to transmit data as follows. There is one UDP server and one TCP server, both with the same application layer PDU standard, and you must successfully transmit a single application PDU to each of the two. In each case, the server is running on a host with IP address 152.46.17.183, and is reachable on port 8222. The application PDU is described below. In addition, the UDP server exepcts the entire application PDU to be embedded in a single UDP packet. (Note: The machine on which this server is running has most other network ports blocked by a firewall. Thus ping or other network probes cannot be expected to succeed. Your only way of verifying that the server is up is to send something to it, and received back the response as specified below.) The first four bytes of the application PDU must be the bytes representing the corresponding UNICODE or ANSI characters N, C, S and U. The next nine bytes must be similarly byte encodings of the characters in the string representation of your 9- digit student ID. (Note: They must be the character encodings rather than the actual number. For example, if your student ID is 987654321, then the first byte must not have the value 9, but rather the value 57, which is the ANSI encoding for 9.) (Note: These first two fields of the message appear to be like strings, but they are NOT null-terminated. If a null is inserted, it would be misinterpreted by the server as the first byte of the next field.) (Note: Unlike memory data structures or files, once you write a byte into a socket, you cannot go back and take it back or write over it, obviously.) The next four bytes should be your 9-digit student ID expressed as a 4-byte number. Depending on your programming platform of choice, this may be an int, a long, an unsigned long, or some similar data type. However, the server expects to receive the 4 bytes making up this number in the order of most significant byte first. (Note: This ordering of bytes is often called the network byte order, because this is the standard ordering for programs to exchange data. A standard is needed since different platforms vary in how they locally store multi-byte numbers. So called BIG_ENDIAN systems store numbers so that the MSB is in the lowest address, whereas systems that store the LSB in the lowest address space are called LITTLE_ENDIAN. Since transmission typically occurs from the lowest address up think of how strings are transmitted the network byte order corresponds to BIG_ENDIAN. Macros such as ntohs(), htons() etc. provide easy ways for the application programmer to always ensure network byte order without having to know the byte ordering of the platform that the code will be running on read the manual pages of these for details on how to use them.)

(Note: sizeof() is a handy function to find out how many bytes make up a particular data type, such as int, on your local platform.) The rest of the application PDU must be a single null-terminated string, with the following information as string in the following format: <Your name>\n<your 9- digit student ID>\n<The dotted decimal representation of the IP address you are sending from>\n<the port number you are sending from>\ncsc573-001 2016\n<Current date and time on your system in mm/dd/yyyy hh:mm format>\n. (The \n indicates the UNIX newline character.) When the server prints it out, it should look like the following: Rudra Dutta 987654321 152.14.84.128 12596 CSC573-001 2016 9/7/2017 20:43 It is also acceptable to have the date format 09/07/2016. (Note: The null termination at the end of this string is the only way the server knows that the APDU is concluded. If you send data to the server that does not so terminate, you can hang the server, or at least the thread servicing you. Please aim to avoid this.) Neither the UDP nor the TCP server will accept an application PDU of more than 1000 bytes from the socket, so your program should ensure this is what the server receives. In each case, the server will send back a string Server received and archived <X> bytes of transmitted data, which your program should receive from the socket, where X is the number of bytes the server read in total. If you receive any other string, or receive nothing, then your transmission did not succeed, and you should re-try, after checking your program for errors. Since servers as well as server programs can have temporary problems, or there may be network problems, a failure does not necessarily indicate a problem in your program. 9. In this question, you will set up and conduct an experiment on ExoGENI. You may access GENI from anywhere on the Internet, but to avoid needless extra effort in key management etc., I suggest that for this initial short set of exercises, you use any one platform with a stable network connection, and complete the whole exercise from there. First, re-read the how-to document, which has been updated with more information. The only changes are that Appendices B and C have been added. You must read Appendix B, which specifies the rack you are allowed to use. Appendix C is very useful to work through, but will take a little time and effort. Some of you will choose to defer it until you do a more complex ExoGENI exercise, but you will have to complete it sooner or later. Next, read and perform the online tutorial at http://www.exogeni.net/2015/09/exogeni-getting-startedtutorial/. You will have done part of this for the previous homework already, so make sure to not to repeat steps you obviously should not repeat. Then make sure that you can do the rest of the tutorial. This part of this question is ungraded no deliverables need be submitted. Then continue with the following exercise. Using Flukes, your objective is to create the same simple 4-node path topology as you did in Q7 of Homework 2, this time creating VMs, creating virtual links, and assigning IP addresses to virtual interfaces as necessary.

Once you have done so, perform the same procedure as in that previous question, and submit the output of each step. (Note: While working on GENI, you may face a confusing complication. ExoGENI VMs will always have one more network interface than you specify in your slice design this is the management interface that the ExoGENI SM uses to provision and control the VM. Under certain circumstances, this interface may be visible to you. Depending on whether all your VMs come from the same aggregate or different aggregates, all the VMs may be directly connected to each other using the management backplane thus connectivity experiments will fail they will always seem to be connected and reachable. To avoid this, make sure you are pinging the IP addresses that you assigned to the interfaces you created not the management interfaces. Typically the management interfaces will have 10. addresses we suggest you use completely different addresses for the interfaces you create using Flukes, and make sure to ping those.) 10. Consider the interconnected LAN shown in Figure 1 (adapted from Tanenbaum). Assume that hosts a and b are on LAN 1, c is on LAN 2, and d is on LAN 8. Initially, hash tables in all bridges are empty and the spanning tree shown in Part (b) of the Figure is used. Show how the hash tables of different bridges change after each of the following events happen in sequence (i.e. first (a) happens, then (b) happens, and so on). (Just show the mapping created by the hash tables, you need not consider the hashing.) (a) d sends to a (b) a sends to c (c) d sends to c (d) The bridge D malfunctions, and a new spanning tree is established by the bridges automatically by activating the minimum number of inactive bridges possible (assume no other bridge can sense the failure and their hash tables remain unchanged by this event) state what bridges are now active (e) d sends to a Figure 1 Provide your answer in a table such as the following. Only include entries for which a bridge has an actual hash table entry.

After part Bridge Has hash table entry for Pointing to port Host connected to LAN (a) A b? (b) c? d? B 11. (Tanenbaum, 5.40) A large number of consecutive IP addresses are available starting at 204.16.0.0 for allocation using CIDR blocks. Suppose that four organizations, A, B, C and D, request 4000, 2000, 4000 and 2000 addresses, respectively and in that order. The allocating authority always assigns the earliest possible valid block to any request. (a) For each of these, give the first IP address assigned, the last IP address assigned, and the mask in the w.x.y.z/s notation. (b) Later it is found that all of them need to be forwarded to the same router, anyway. Can any of them be aggregated?