% mkdir [reliable2] % cp -R [reliable1]/* [reliable2] % cd [reliable2] % setenv AUTOCONF_VERSION 2.13 % cp ~class/src/reliable2/rlbtester2.c ~class/src/reliable2/Makefile.am . % sh ./setup ... % setenv DEBUG -g % ./configure ... % gmake clean % gmake ...
To send MTU-sized packets, there are two cases to consider.
First, you should pack as much data received during separates reads (i.e., received by handle_data) during one intra-timer period into a single packet. Thus, if handle_data receives 10 bytes, then 44 bytes, then 12 bytes during one timer cycle, you should send this out as one packet: 1 reliable_hdr followed by 66 bytes of payload.
Second, you should spam large reads across multiple packets. If during one intra-timer period, you received 1500 bytes, then another 1500 bytes, and say sizeof (struct reliable_hdr) is 12 and pkt_mtu is 1460, this algorithm should create the first packet of payload length 1448, the second packet of length 1448 (the last 52 bytes from the first 1500 bytes read, and the first 1396 bytes of the second read), and the last packet of payload length 54 bytes.
Note that, optimally, you always want to send out full MTU-sized packets. However, "TCP" neads a fast response as it is often using for "real-time" protocols like telnet. Thus, even if you only have a little bit of data, you still want to push it out relatively fast, which is why you should only assemble packets during the intra-timer period (the time between 2 calls to your timer function), as opposed to waiting (possibly indefinately) to read MTU bytes.
% ./srvd [port] % ./clntd [port]
The server (svrd) and client (clntd) expect you to give them the same port (> 1024). If your program is working correctly, anything you type into the client should output by the server to STDOUT in the same order it was input.
Our new official test program can be run via;
% ./rlbtester2 ./clntd ./srvd
% gmake distcheck rm -rf reliable-0.0 ... ============================================== reliable-0.0.tar.gz is ready for distribution ============================================== %To turn in your distribution, copy it to the directory
~class/handin/lab6/usernamewhere username is your username:
% cp reliable-0.0.tar.gz ~class/handin/lab6/`logname`/ %To create a script file, use the
scriptcommand. When you run script, everything you type gets saved in a file called typescript. Press CTRL-D to finish the script. The typescript should be copied to the same directory as the software distribution. For example:
% script Script started, output file is typescript % ./test-reliable ./rlbtester2 ./clntd ./srvd rlbtester: success: read [Hello.This is only a test.] Finished test for packing messages to prevent short writes... rlbtester: success: have multiple outstanding packets Finished test for sending multiple outstanding messages... rlbtester: success: read [Testing 000 Testing 000 Testing 000 Testing 000 Testing Testing 000 Testing 000 Testing 000 Testing 000 Testing Testing 000 Testing 000 Testing 000 Testing 000 Testing Testing 000 Testing 000 Testing 000 Testing 000 Testing ... Testing 555 Testing 555 Testing 555 Testing 555 Testing Testing 555 Testing 555 Testing 555 Testing 555 Testing Testing 555 Testing 555 Testing 555 Testing 555 Testing ] Finished test for handling packet reordering... Finishing experiment: 10 out of 10 points [Internal use only: mfreed @ Fri Apr 23 16:04:28 EDT 2004 MD5 (./clntd) = cbecd21ba118ac8ec05991058f4a5996 MD5 (./srvd) = 8f8915c52ef29ebc548549cb8e8d0f0e % ^D Script done, output file is typescript % cp typescript ~class/handin/lab6/`logname`/ %If you have any questions, please contact us at netstaff (at) class cs nyu edu.