Part C (50 marks)
The RUSH protocol (Reliable UDP Substitute for HTTP) is a HTTP-like stop-and-wait protocol that uses UDP
in conjunction with the RDT rules. You have recently been hired by the multinational tech giant COMS3200 Inc,
who have identified your deep knowledge in the field of transport-layer protocols. The CEO of COMS3200 Inc, Dan
Kim, has asked you to develop a network server capable of sending RUSH messages to a client. It is expected that
the RUSH protocol is able to handle packet corruption and loss according to the RDT rules. Your server program
must be written in Python, Java, C, or C++.
ASIDE: The RUSH protocol is not a real networking protocol and has been created purely for this assignment
Program Invocation
Your program should be able to be invoked from a UNIX command line as follows. It is expected that any Python
programs can run with version 3.6, and any Java programs can run with version 8.
Python
python3 assign2.py
C/C++
make
./assign2
Java
make
java Assign2
RUSH Packet Structure
A RUSH packet can be expressed as the following structure (|| is concatenation):
IP-header || UDP-header || RUSH-header || payload

代做COMS3200作业、代写Python, Java, C/C++程序作业、HTTP-like留学生作业代写
The data segment of the packet is a string of ASCII plaintext. Single RUSH packets must be no longer than 1500
bytes, including the IP and UDP headers (i.e. the maximum length of the data section is 1466 bytes). Packets that
are smaller than 1500 bytes should be padded with 0 bits up to that size. The following table describes the header
structure of an RUSH packet:
Bit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 Sequence Number
16 Acknowledgement Number
32 Flags Reserved (should be 0)
The following sections describe each header in this packet further.
3
Sequence and Acknowledgement Numbers
Sequence numbers are independently maintained by the client and server. The first packet sent by either endpoint
should have a sequence number of 1, and subsequent packets should have a sequence number of 1 higher than the
previous packet (note that unlike TCP, RUSH sequence numbers are based on the number of packets as opposed
to the number of bytes). When the ACK flag is set, the acknowledgement number should contain the sequence
number of the packet that is being acknowledged. When a packet is retransmitted, it should use the original
sequence number of the packet being retransmitted. Any packet that isn’t a retransmission (including NAKs)
should increment the sequence number.
Flags
The Flags section of the header is broken down into the following:
Bit 0 1 2 3 4
0 ACK NAK GET DAT FIN
The purpose of these flags is described in the example below.
RUSH Example
The following situation describes a simple RUSH communication session. Square brackets denote the flags that are
set in each step (for example [FIN/ACK] denotes the FIN and ACK flags having the value 1 and the rest having
the value 0). Note that RUSH, unlike TCP, is not connection-oriented. There is no handshake to initialise the
connection, but there is one to close the connection.
1. The client sends a request packet to the server [GET]
The sequence number of this packet will always be 1
The data section of this packet will contain the name of a resource (eg. file.txt)
2. The server transmits the requested resource to the client over (possibly) multiple packets [DAT]
The first packet should have a sequence number of 1
3. The client acknowledges having received each data packet [DAT/ACK]
The acknowledgement number of this packet should be the sequence number of the packet being acknowledged
4. After receiving the last acknowledgement, the server signals the end of the connection [FIN]
5. The client acknowledges the connection termination [FIN/ACK]
6. The server acknowledges the client’s acknowledgement and terminates the connection [FIN/ACK]
4
Your Task
Basic Server Functionality (10 marks)
To receive marks in this section you need to have a program that is able to:
Listen on an unused port for a client’s message
Successfully close the connection
When invoked, your program should let the OS choose an unused localhost port and your program should listen
on that port. It should output that port as a raw base-10 integer to stdout. For example, if Python was used and
port 54321 was selected, your program invocation would look like this:
python3 assign2.py
54321
Any lines in stdout after the port number can be used for debugging. For this section, your program does not
need to respond to the GET request. Upon hearing from a client, your program can immediately signal the end of
the connection (as described in the example). Once the FIN handshake has been completed, your program should
terminate.
You may always assume that only one client will connect to the server at a time. For this section and the next you
may also assume that no packets are corrupted or lost during transmission.
File Transmission (10 marks)
To receive marks in this section you need to have a program that is able to:
Perform all features outlined in the above section
Successfully transmit a requested file over one or more packets
Receive (but not handle) ACKs from the client during transmission
When your server receives a GET packet, it should locate the file being requested and return the file’s contents
over one or more DAT packets. When complete, the server should close the connection (as in the above section).
You may assume that the file being requested always exists (it is expected that this file is stored in your program’s
working directory).
Retransmission (15 marks)
To receive marks in this section you need to have a program that is able to:
Perform all features outlined in the above sections
Retransmit any packet on receiving a NAK for that packet
Retransmit any packet that has not been acknowledged within 3 seconds of being sent
A client will send a DAT/NAK packet should it receive a corrupted packet or a packet with a sequence number it
wasn’t expecting (the NAK packet’s acknowledgement number will contain the sequence number it was expecting).
In this case your program should retransmit the packet with that sequence number.
If a DAT, FIN, or ACK packet gets lost during transmission your program should retransmit it after 3 seconds
without acknowledgement. If a NAK is received the timer should reset. How you choose to handle timeouts is up
to you, however it must work on a UNIX machine (moss). Achieving this through multithreading, multiprocessing,
or signals is fine provided you only use standard libraries.
5
Packet Corruption (15 marks)
To receive marks in this section you need to have a program that is able to:
Perform all features outlined in the above sections
Gracefully ignore corrupt, invalid, or unexpected packets
When a corrupt, invalid, or unexpected packet is received, your program should ignore it and continue to run
without error. Any retransmission timer should also not stop or reset. Part of this task is determining what would
constitute as an invalid or unexpected packet. You can assume that the only legal flag combinations are GET,
DAT, DAT/ACK, DAT/NAK, FIN, and FIN/ACK. You don’t have to worry about checking the UDP checksum -
only the contents of the RUSH header and data.
Tips for Success
Revisit the lectures and labs on reliable data transfer and TCP, ensuring you are familiar with the fundamentals
Frequently test your code on moss
Ensure your base functionality is working before attempting the more difficult tasks
Start early - there will be limited help during the midsemester break so any questions will need to be asked
in labs beforehand
Library Restrictions
The only communication libraries you may use are standard socket libraries which open UDP sockets
You can’t use any libraries that aren’t considered standard for your languagei.e. if you have to download a
library to use it it would be considered as non-standard)
If you are unsure about whether you may use a certain library, please ask the course staff on Piazza
Submission
Submit all files necessary to run your program. At a minimum, you should submit a file named assign2.py,
assign2.c, assign2.cpp or Assign2.java. If you submit a C/C++ or Java program, you should also submit a
makefile to compile your code into a binary named assign2 or a .class file named Assign2.class.
IMPORTANT: If you do not adhere to this (eg. submitting a C/C++/Java program without a Makefile, or a
.class file instead of a .java file), you will receive 0 for this part of the assignment.
Marking
Your code will be automatically marked on a UNIX machine, so it is essential that your program’s behaviour is
exactly as specified above. Your program should complete all tasks within a reasonable time frame (for example a
single packet should not take more than one second to construct and send) - there will be timeouts on all tests and
it is your responsibility to make sure your code is not overly inefficient. It is expected that you will receive a small
sample of tests and a basic RUSH client program before the submission deadline.
There are no marks for coding style.

因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com

微信:codinghelp

COMS3200 The RUSH protocol的更多相关文章

  1. 学习笔记:URL Protocol在浏览器中打开本地应用程序

    看到阿里的网站上可以通过点击卖家的旺旺图标从而调用本地的阿里旺旺程序,而且还可以传递当前浏览者需要咨询的商品.这是怎么实现的呢?是通过URLProtocol来完成. 原理还没有太清楚,即在系统里注册一 ...

  2. Protocol Buffer搭建及示例

    本文来源:http://www.tanhao.me/code/150911.html/ Protocol Buffer(简称Protobuf或PB)是由Google推出的一种数据交换格式,与传统的XM ...

  3. 从零开始山寨Caffe·伍:Protocol Buffer简易指南

    你为Class外访问private对象而苦恼嘛?你为设计序列化格式而头疼嘛? ——欢迎体验Google Protocol Buffer 面向对象之封装性 历史遗留问题 面向对象中最矛盾的一个特性,就是 ...

  4. oracle plsql 无法连接 报 ORA-12560: TNS:protocol adapter error

    ORA-12560: TNS:protocol adapter error 添加一个环境变量,名为TNS_ADMIN,值为 tnsnames.ora 文件所在路径.比如我的本机为:D:/instant ...

  5. 窥探Swift之协议(Protocol)和委托代理(Delegate)回调的使用

    协议与委托代理回调在之前的博客中也是经常提到和用到的在<Objective-C中的委托(代理)模式>和<iOS开发之窥探UICollectionViewController(四) - ...

  6. ORA-12516:TNS:listener could not find available handler with matching protocol stack

    应用程序连接测试数据库时报ORA-12516:TNS:listener could not find available handler with matching protocol stack 检查 ...

  7. Serial Communication Protocol Design Hints And Reference

    前面转载的几篇文章详细介绍了UART.RS-232和RS-485的相关内容,可以知道,串口通信的双方在硬件层面需要约定如波特率.数据位.校验位和停止位等属性,才可以正常收发数据.实际项目中使用串口通信 ...

  8. [原创翻译]Protocol Buffer Basics: C#

    Protocol Buffer 基础知识:c#    原文地址:https://developers.google.com/protocol-buffers/docs/csharptutorial   ...

  9. 让Web API支持Protocol Buffers

    简介 现在我们Web API项目基本上都是使用的Json作为通信的格式,随着移动互联网的兴起,Web API不仅其他系统可以使用,手机端也可以使用,但是手机端也有相对特殊的地方,网络通信除了wifi, ...

随机推荐

  1. 总结-shell脚本

    执行脚本从 svn 检出项目 vi ace.sh #!/bin/bash svn export svn://127.0.0.1/ace/demo /ace/demo 设置脚本可执行 chmod +x ...

  2. java_基础_abstract抽象关键字

    java中,当父类中的某些东西不确定时,可以用abstract关键字将此类变成抽象类(也就是说类并不完整,有些东西要等待子类去实现) 注意事项: 1.抽象类中的抽象方法不能有实体,格式如下 publi ...

  3. JS之数组的几个不 low 操作

    JS之数组的几个不 low 操作 1.扁平化n维数组 1)终极篇 [1,[2,3]].flat(2) //[1,2,3] [1,[2,3,[4,5]].flat(3) //[1,2,3,4,5] [1 ...

  4. 基础作业 本周没上课,但是请大家不要忘记学习。 本周请大家完成上周挑战作业的第一部分:给定一个整数数组(包含正负数),找到一个具有最大和的子数组,返回其最大的子数组的和。 例如:[1, -2, 3, 10, -4, 7, 2, -5]的最大子数组为[3, 10, -4, 7, 2] 输入: 请建立以自己英文名字命名的txt文件,并输入数组元素数值,元素值之间用逗号分隔。 输出 在不删除原有文件内容

    1丶 实验代码 #include<stdio.h> int main(void) { int tt,nn,i,j,c[11][11]; int flag=1; scanf("%d ...

  5. less的使用(好文章)

    好文章链接:30分钟学会less 自己总结一下这篇文章中的几个关键字:变量.混合.函数.嵌套.@import 下面贴上自己照着上面写的一些代码: <template> <div cl ...

  6. yum解决 "Couldn't resolve host 'apt.sw.be'" 错误

    1.yum无法安装工具    failure: repodata/repomd.xml from dag: [Errno 256] No more mirrors to try.http://apt. ...

  7. MPLS的模拟学习过程

    1.场景拓扑 使用小凡模拟器搭建了如下网络拓扑,使用的镜像为:c3640-jk9o3s-mz.122-15.T9.bin 相关的配置在下方 如果重复实验,需要清空设备的配置,知道路由器的密码,操作步骤 ...

  8. 时间、日历(time、calendar、datatime)

    import time import calendar import datatime #获取代码运行的时间差 start = time.time() end = time.time() print( ...

  9. python 使用 PIL 和 matplotlib 获取图片像素点处理之后再写入

    python 版本 3.x 首先安装 PIL 由于PIL仅支持到Python 2.7,加上年久失修,于是一群志愿者在PIL的基础上创建了兼容的版本,名字叫Pillow,支持最新Python 3.x,又 ...

  10. python点点滴滴

    python点点滴滴 1 self 使用python编程实现邮箱登录时,遇到使用self的情况,在此做简要记录. 参考链接: https://sjolzy.cn/Why-should-self-Pyt ...