?? readme
字號:
Andrew Trusty - atrusty@gatech.eduCS3251 Section BNov 20, 2006Programming Assignment 2: ARQ Programmingfiles: README - this file, describes things... SAMPLE - sample output of client and server execution makefile - the build file for the source (Linux only) libcommon.c - library of common functionality for client and server libcommon.h - header file for libcommon.c myftclient.c - source for the file transfer client myftserver.c - source for the file transfer server dropper.c - alternate sendto interface to simulate packet loss dropper.h - header file for dropper.ccompiling & running: on helsiniki.cc.gatech.edu or a compatible Linux machine with all files in a single directory compile: > make run server: > ./myftserver [-d] <server_port_number> <buffer_size> <loss_percent> run client: > ./myftclient [-d] <server_name> <server_port_number> \ <local_filename> <max_packet_size> <loss_percent> For the purposes of testing the server appends a '2' to everyfilename before it writes it out in case it is being run in the samedirectory that the client is. This way the server doesnt changethe file that the client is sending.protocol: The following is the UDP file transfer protocol implementedfor the above client and server applications. The goal of thisprotocol is to efficiently and reliably transfer files over a UDPconnection in an iterative and not concurrent manner between oneclient and one server. The protocol uses UDP sockets. It begins with a simple two wayhandshake in which the client sends a packet with a header containingthree unsigned integers, the sequence number which should be 0, thelength of the file being transmitted in bytes, and the length of thename of the file in that order. This is followed by the actualfilename string without the terminating null character. After the filename string the packet contains as much data from the file being transferred as will fit in the packet. The max size of this initial packet is the minimum of the servers buffer (currently 1024) or themax packet size given to the client as a command line argument. The client then blocks until it receives an ACK from theserver containing just two unsigned integers, the expected next packetbyte sequence number from the client and sending credit in bytes forthe client in that order. If no ACK is received after some timeout (currently 1s) then the client will send the initial packet again. It will resend the initial packet some number of times (currently 25times) until the server ACKs or it gives up. After the initial packet ACK is received the client proceedsto send as much data from the file as it can in the given credit usingnormal packets. Normal packets are just an unsigned integer for thesequence number followed by as much data as will fit in the packet. The max packet size of each normal packet is the minimum of the user defined max packet size or the server credit remaining. Once the client has exhausted its credit it will check for anyACKs that it may have received from the server while it was sendingnormal packets. The server should be sending an ACK packet for every normal packet it gets. If there are no server ACKs then the client will resend everything it just sent. If there are some ACKs but not as many as there should be given the number of normal packets sent then the client will get thecredit from the most up to date ACK as determined by the largest expected sequence number and then send as many normal packets as it can starting from that largest expected sequence number. If there are ACKs for all of its normal packets then it willtake the credit from the most up to date ACK and begin sending morenormal packets. This process of sending normal packets until credit is exhausted and then checking for more credit loops until the whole fileis sent to the server. There is no special case for when the last datafrom the file is sent since both the client and server know how bigthe file is and they can act appropriately. If the client is unable to get a single ACK for some window ofnormal packets that it sends some number of times (currently 25) thenit will stop trying and terminate. Also, the server has a client inactivity timer so thit it will automatically reset itself so it can accept new connections after some period of inactivity (currently 30s). It is undefined what occurs when concurrent clients or filetransfers are attempted, but in my implementation the new client ispreferred such that the old clients session is trashed. The new clientis still not guaranteed to have a successful file transfer given thatthe old client will probably still be sending packets to the serverwhich may interfere with the new clients packets.limitations: Does not support concurrent clients or concurrent filetransfers. File transfer is one way, client to server only.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -