Course Overview
The course considers the basic Application Programming Interfaces APIs for UNIX.
The client-server paradigm and the socket interface used by application programs
to access TCP/IP protocol suite are introduced. Server algorithms are discussed
in depth and evaluated based on the choice of concurrency and transport (e.g.
connection-oriented TCP or connectionless UDP). Remote procedure calls are studied
in the context of the client-server model and the generation of distributed programs.
The TELNET protocol is chosen to provide an example for developing client-server
software with a complex protocol. Throughout the course special attention is
given to software engineering aspects in designing communication protocols.
Prerequisites
Two programming courses (including CS 341), and TC535, or consent of instructor.
We assume that students have a basic level of knowledge of computer networks
and thus will spend only a small fraction of lecture time reviewing introductory
material.
Learning Objectives
Writing communication software becomes very important with the growing network
market. Writing good communication software represents a challenge to overcome
the software engineering problems and the problems concerning network protocols
and distributed systems. The life cycle of a communication program and especially
its testing becomes more complicating due to the non deterministic behavior of
the underlying network and of the interacting computing systems. Furthermore,
the communicating programs should be able to use common types of data structures
in spite of the separate address spaces. The goal of this course is to provide
a solid background in the design, analysis and testing of the major classes of
Internet application protocols and cooperation mechanisms, in a popular environment
(UNIX). Students who have completed the course will be able to develop their
own Internet application programs (in C) and to test them.
Evaluation and Grading
New material will be presented in lecture format. Reviews, exercises and homework
solutions will take place in discussion. Participation in the discussions, although
not mandatory, is strongly recommended and may result in extra credit.
Weekly mandatory homework, a midterm and a final examination will provide the
basis for the grade. The homework is due one week after handed out. Late homework
will not be accepted unless permission by the instructor was given prior to the
due date.
No predetermined scale will be used. The final grade will be assigned based on
the following weighting
•
Homework 40%
•
Midterm 25%
•
Final 35%
Academic Honesty
The course is governed by the Academic Conduct Committee policies regarding plagiarism
(any attempt to represent the work of another person as one's own). This includes
copying (even with modifications) of a program or segment of code. You can discuss
general ideas with other people, but the work you submit must be your own. Collaboration
is not permitted.
Instructor Information
Instructor: Rumen Stainov, B.S., M.S.
Computer Science Department, Metropolitan College,
Boston University
808 Commonwealth Ave, Room 250,
Boston, MA 02215
Office: 617-358-0005
Email: mailto: rstainov@bu.edu
Lab
Interactive Classroom
Sign up for the interactive classroom to view your scores, submit homework, or
simply chat about topics discussed in class. All you need is request an account
by accessing the Interactive Classroom and clicking at the 'Request an Account'
button under the 'Student' heading.
Homework
Week 1: Administrative Tasks (10 homework points) (due to 01/28)
Attention: Your individual account on met102-47.bu.edu will be set up. Please
don’t use the same password as the login name (everybody can read the login
names in the “home” directory).
1. 1. Apply for the Interactive Classroom individually.
2. 2. Download the course slides from MET102-47.bu.edu using FTP. (You may download
a ftp client (WS-FTP LE) from www.tucows.com)
3. 3. Telnet to MET102-47.bu.edu, login as tc675tyn, and create a subdirectory
for your Web pages in public_html.
Hint: Go in Windows to Start--> Run
type telnet 128.197.102.47
type the login and the password provided in the class
type ls (to list all files and directories)
go to the WEB directory with cd public_html
type ls (to see the existing web pages)
type mkdir my_name to create a subdirectory for your pages
type cd my_name and ls to see that it is still empty.
(for more UNIX refer to http://www.seas.r ochester.edu:8080/CNG/docs/)
4. 4. Create a web page on MET102-47.bu.edu (128.197.102.47) for you, and put
the student's names on it.
Hint: I used MS Word to create this page http://met102-47.bu.edu/~tc675tyn/tc675.htm
. To do this click on File à Open à Look in: Add/Modify FTP Locations,
and specify as name of the FTP side: met102-47.bu.edu, as user tc675tyn, and
the password given in class. Add this location to the FTP sides, and double click
on it. Go to the directory home/tc675tyn/public_html and create a subdirectory
specifying the name of your group. Thereafter, your WEB page can be written as
a normal MS Word file and saved as *.html, or *.htm in this directory. (You may
use other approaches also. For example, I posted some of my *.html files into
public_html on 128.197.102.47 using FTP). You can also post your WEB into the
public_html directory of your individual account.
5. 5. Update the file public_html/list.html on 128.197.102.47 with your name,
email address, and web page URL
Hint: FTP from public_html/list.html, edit it using MS Word 2000, FTP the edited
list.html back to 128.197.102.47, check later with http://met102-47.bu.edu/~tc675tyn/list.html
that you are (still) on the list.
6. 6. Find out the files to the textbook (Comer, D.E., W. Stevens. Internetworking
with TCP/IP, Vol. III (Linux / POSIX Sockets Version ..at http://www.cs.purdue.edu/people/comer),
download, and unzip them on a Unix computer. (You may telnet the class computer
running Linux).
7. 7. Send to rstainov@bu.edu a faked e-mail using TELNET. Specify as "sender" president@bu.edu.
The message should contain your name, your real e-mail address (to be added to
the class mail list), and the text (first 10 rows) of the Makefile in folder "examples" of
the files to the textbook. Specify as "subject" tc675tyn.
Readings: Ch. 1
The Instructor will provide:
Access to class computer (MET102-47.bu.edu) in TelecomLab, 808 Comm. Ave, room
265, and on request to our private LAN computers. Can always telnet from outside.
On request an account on MET102-47.bu.edu.
________________________________________
Week 2 (10 points) (due to 02/04):
1. 1. Learn about UNIX using for example http://www.seas.rochester.edu:8080/CNG/docs/.
Minimum required readings: the "Introduction", the "Intermediate
UNIX", one editor in "Editors and Formatters", and the "Programming
Tools" (only C programming without SHELL PROGRAMMING). Please consider the
free tutorials at BU: www.bu.edu/computing/tutorials Try to compile TCPecho.c
using the Makefile (e.g., make TCPecho). Use an editor (like vi or emacs) to
debug the source file. Compile and start the client. Debug and compile the corresponding
server (deamon) TCPechod.c (e.g., make TCPechod), and start it in background.
Start the client again to interact with the running server over the localhost
interface. Use netstat to see this interaction. List the running processes using
ps -l. Terminate (kill) the deamon TCPechod.
3.1 Run the example programs on your local computer system. Approximately how
many iterations of the output loop can a process make in a single timeslice?
3.2 Write a concurrent program that starts five processes. Arrange for each process
to print a few lines of output and then halt.
3.4 Read more about the UNIX fork function. What information does the newly created
process share with the original process?
3.5 Write a program that uses execve to change the code a process executes.
3.6 Write a program that uses select to read from two terminals (serial lines),
and displays the results on a screen with labels that identify the source. (Hint:
use %who to find out the names of your terminal sessions, and than open them
like this: tty_fd1 = open("/dev/ttyp2", O_RDWR|O_NDELAY); --> the
returned file descriptors can be used with select.)
Readings: Ch., 2-3
________________________________________
Week 3 (4 points) (due to 02/11):
5.2 Use gettimeofday to measure the execution time of the following socket calls:
socket(), connect(), read(), and write(). Repeat those measurements using the
TCP/IP Debug and Performance Tool netlog. Why do some calls require orders of
magnitude more time than others'? Hint: Look at TCPtecho.c to see an example
how to use gettimeofday
Readings: Ch. 3
________________________________________
Week 4 (10 points) (due to 02/19):
6.3 Build client software that uses gethostbyname to look up machine names at
your site and print all information returned. Which official names, if any, surprised
you? Do you tend to use official machine names or aliases? Describe the circumstances,
if any, when aliases may not work correctly.
6.4 Measure the time required to look up a machine name (gethostbyname) and a
service entry (getservent). Repeat the test for both valid and invalid names.
Does a look up for an invalid name take substantially longer than for a valid
one? Explain any differences you observe.
6.6 To test whether your machine's local byte order is the same as the network
byte order, write a program that uses getservbyname to look up the ECHO service
for UDP and then prints the resulting protocol port value. If the local byte
order and network byte order agree, the value will be 7.
IPv6 Assignment: Learn more about IPv6 from the paper posted. Rewrite the TCPecho.c
program to work with IPv6. Use the examples given at http://jadzia.bu.edu/~danka/ushte/tc893/assignment0.html
. To do this, use the account tc675tyn on 128.197.102.48.
Readings: Ch. 5-6
________________________________________
Week 5 (10 points) (due to 02/25):
7.4 Modify the TIME client so it computes E, the time that elapses between when
it sends the request and when it receives a response. Add one-half E to the time
the server sends
7.9 The example ECHO clients in this chapter do not use shutdown. Explain how
the use of shutdown can improve client performance.
7.10 Rewrite the code in UDPecho.c so it tests reachability by generating a message,
sending it, and timing the reply. If the reply does not arrive in 5 seconds,
declare the destination host to be unreachable. Be sure to retransmit the request
at least once in case the internet happens to lose a datagram. (Hint: Use as
timer select() as given in Linux "man" pages).
8.7 Rewrite the TCP echo client so uses a single process to concurrently handle
input from the keyboard, input from its TCP connection, and output to its TCP
connection.
Readings: Ch. 7-8
________________________________________
Week 6 (14 points) (due to 03/25):
9.3 Conduct an experiment to determine what happens if N clients all send M requests
(in a loop) to UDPtimed simultaneously. Vary both N, the number of senders, and
S, the size of the datagrams they send (simulate this by letting UDPtimed to
sleep during processing the request ). Explain why the server fails to respond
to all requests. (Hint: look at the manual page for listen, and slow down the
server execution using for example sleep.)
9.6 As a security check, the system manager asks you to modify UDPtimed so it
keeps a written log of all clients who access the service. Modify the code to
print a line on the console whenever a request arrives. Explain how logging can
affect the service.
10.5 Modify the example server code in TCPdaytimed.c so it does not explicitly
close the connection after writing a response. Does it still work correctly?
Why or why not? Conduct an experiment to determine what happens if the client
sends M= ¥ requests (in a loop) to TCPdaytimed simultaneously (denial-of-service
attack). Repeat the experiment, with the original version of TCPdaytimed. Comment
this happening in sense of statefull and stateless.
10.8: Comment some possible ways to prevent statefull servers from denial-of-service
attacks. Implement one of them to prevent the statefull version of TCPdaytimed.c
from being crashed (in the way described in 10.5).
12.0 Rewrite the midterm HTTPclient program to use a separate thread for downloading
of each .gif file.
12.5 The example code for the monitor holds the mutex while it formats and prints
the statistics. Modify the code so the monitor only holds the mutex long enough
to make a copy of the stats structure.
Bonus: (2 additional points) The example monitor uses a separate thread to periodically
print statistics. Use the Linux alarm mechanism to implement the same functionality.
What are the advantages and disadvantages of each approach?
Readings: Ch. 9-12
________________________________________
Week 7 (10 points) (due to 04/01):
14.3 The example code allows the user to specify a service name or protocol port
number as an argument, and uses the argument when creating passive sockets for
the service. Is there an example of a service that uses a different protocol
port number for UDP than for TCP?. Change the code to allow the user to specify
a separate protocol port number for each protocol.
14.4 The example server does not allow the system manager to control, which protocols
it uses. Modify the server to include arguments that allow a manager to specify
whether to offer the service for TCP, UDP, or both.
14.5 Consider a site that decides to implement security through authorization
scheme. The site provides each server with a list of authorized client machines,
and makes the rule that the server must disallow requests that originate from
machines other than those on the list. Implement the authorization scheme for
the example multiprotocol server. (Hint: look carefully at the socket functions
to see how to do it for TCP).
15.4 Add a UDP service to the example multiservice server described in this chapter.
15.6* Design and implement a super server that allows new services to be added
without recompiling or restarting processes.
Readings: Ch. 14-15
* This problem is optional. A right solution however, brings about 3 additional
homework points.
________________________________________
Week 8 (10 points) (due to 04/08):
1. Modify one of the example servers in previous chapters to use combined delayed
allocation and preallocation (see sec. 15.11). How does the performance change?
Hint: See the examples in notes/Lecture9.doc
2. Implement a HTTP proxy that works as an application gateway used for authentication
of the internal clients willing to connect to the Internet. To do this, extend
the HTTP-Client to be able to receive the error code 401 following by some header
information, including the key word www-authenticate:, which requires additional
authentication for the "area" (ASCII string separated by spaces). The
client answers by putting the "area" word into the field [password]
after the key word authorization. Use threads to ensure concurrency if more then
one clients are using the proxy.
Readings: Ch. 16-17
________________________________________
Week 9 (10 points) (due to 04/22):
22.1 Modify the example program from this chapter so the client interface routine
keeps a cache of recently referenced words and searches the cache before making
a remote pro¬cedure call. How much additional computational overhead does
the cache require (in usec)? How much time (in usec) does the cache save when
an entry can be found locally?
22.4 Modify the example dictionary program so the remote procedures can write
error messages on the client’s standard error file. What problems did you
encounter? How did you solve them? (Hint: Modify the rdict.x file so that the
remote procedures will return character string instead of integer.)
Readings: Ch. 20-22
References
Textbooks
Comer, D.E., Stevens, W., Internetworking with TCP/IP, Vol. 3: Client-Server
Programming and Applications, Linux/Posix Sockets Version, 1/e, Copyright 2001,
601 pp. ISBN 0-13-032071-4
Schedule
M
01/14:
Administrative. Course Overview. The Client Server Model.
Readings: Ch. 1-2
M 01/21:
Holiday. Classes suspended.
M 01/28:
Internet Overview. Concurrent Processing In Client-Server
Software. Program Interface To Protocols.
Readings: Ch. 3-4
M 02/04:
Practical Exercises in UNIX Programming .
M 02/11:
The Socket Interface. Algorithms And Issues In Client
Software Design.
Readings: Ch. 5-6
M 02/18: Holiday. Classes suspended.
T 02/19 (Substitute Monday Schedule):
Algorithms And Issues In Client Software Design (continued).
Example Client Software. Server Algorithms.
Readings: Ch. 7-8
M 02/25:
Iterative, Connectionless and Connection-Oriented Servers.
Concurrent, Connection-Oriented Servers (TCP)
Readings: Ch. 9-11
M 03/04:
Spring Recess. Classes suspended.
M 03/11: Midterm Examination
M 03/18: Using Threads For Concurrency.
Single-Thread, Concurrent Servers.
Readings: Ch. 12-13
M 03/25:
Multiprotocol Servers (TCP, UDP) and Multiservice Servers
(TCP, UDP).
Readings: Ch. 14-15
M 04/01:
Uniform, Efficient Management Of Server Concurrency.
Concurrency In Clients.
Readings: Ch. 16-17
M 04/08:
TCP/IP Connectivity at the Transport and Application
Levels.
Readings: Ch. 18-19
M 04/15: Holiday. Classes suspended.
W 04/17 (Substitute Monday Schedule):
Remote Procedure Call Concept (RPC).
Readings: Ch. 20-22
M 04/22:
A TELNET Client I + II.
Readings: Ch. 26-27
M 04/29: Final Exam

