Chabot College Fall 2002 Removed Fall 2006

advertisement
Chabot College
Fall 2002
Removed Fall 2006
Course Outline for Computer Science 18E
LINUX SOCKETS PROGRAMMING II
Catalog Description:
Computer Science 18E - Linux Sockets Programming II
2 units
Continuation of Computer Science 18D. Advanced socket programming: using standard I/O on
sockets, concurrent client servers, socket options, broadcasting, out-of-band data, the inetd
daemon, network security and file handling. Development of several networked systems
programs. Prerequisite: Computer Science 18C and Computer Science 18D (both completed with
a grade of C or higher). 1.5 hours lecture, 1.5 hours laboratory.
Prerequisite Skills:
Before entering the course the student should be able to:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
demonstrate familiarity with the TCP/IP protocol suite and the general history of how it came
to exist;
demonstrate familiarity with the general history of the Internet and networking in general;
create and manipulate a socket in a C program under Linux;
describe a client-server and a peer-to-peer network relationship;
resolve domain and address families using system calls in Linux;
work with both big-endian and little-endian hardware byte orders;
form a socket address;
work with an abstract local address;
identify when socket addresses are not required;
manipulate IP addresses and do address conversion, if needed;
use an IP netmask;
identify private and reserved IP numbers;
use Linux system calls that convert IP numbers;
identify the classes of IP addresses and be able to identify address of each class;
use the domain, socket type and protocol arguments for socket functions;
bind an IP address to a socket;
get a local socket address from a socket that already has an existing address;
get the socket address from a peer socket;
use bind() to choose a network interface to use for communication;
use connectionless protocols (UDP) over a socket connection;
use connection-oriented protocols (TCP) over a socket connection;
demonstrate a knowledge how and when to use either type of protocol;
identify the differences between Linux operating system file services and the C file library;
use Linux services to provide file access in small C programs;
identify the major types of Linux resources that can be accessed as files: regular files,
named and unnamed pipes, directories, devices, symbolic links and sockets;
use any of these (except sockets) in a C program on Linux;
identify, use, and set owner, group and other permissions on a file or directory;
use Linux file access functions: creat, unlink, open, close, read, write, seek, and ioctl;
move around in a directory tree, and create or remove directories;
implement multiplexed file access using fd_set and select;
lock and unlock files and records;
manage memory-mapped files;
write a simple Linux shell that executes commands, creates pipelines, does I/O redirection,
and uses a tee correctly;
create and use a library;
create and use a daemon.
Chabot College
Course Outline for Computer Science 18E
Linux Socket Programming II
Fall Semester 2002
Page 2
Expected Outcomes for Students:
Upon completion of the course the student should be able to:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
use the ANSI standard C I/O calls on sockets, associate a socket with a FILE stream;
deal with problems related to using standard I/O on streams;
handle an interrupted socket fread() or fwrite() call;
write a server to handle concurrent clients, using fork(), wait(), waitpid(), and select();
retrieve socket options with getsockopt();
set socket options with setsockopt();
use the most commonly needed socket options;
broadcast over IP using UDP: establish a UDP socket, send broadcasts with the socket, and
receive broadcast messages with a socket;
identify out-of-band data and handle it in a program;
identify the inetd daemon and use it;
identify and handle network security issues.
Course Content:
1.
2.
3.
4.
5.
6.
7.
8.
Using standard I/O on sockets
a.
How to associate a socket with a FILE stream (with fdopen())
b.
How to create and apply read and write FILE streams
c.
Issues concerning stream oriented I/O on sockets and closing the socket
d.
Buffering with FILE stream sockets
e.
Handling interrupted system calls
Concurrent client servers
a.
Handling multiple clients from one server
b.
The fork(), wait(), waitpid() and select() system calls
Socket options
a.
Getting and setting socket options with getsockopt() and setsockopt()
b.
The most used socket options and how to apply them
Broadcasting (with UDP)
a.
Establishing a broadcast UDP socket
b.
Sending and receiving broadcast messages over sockets
Out-of-band data
a.
Define out-of-band data
b.
Why is out-of-band data needed?
c.
What socket-related issues arise with out-of-band data?
d.
How does TCP/IP handle out-of-band data?
e.
How do you support out-of-band data with TCP stream sockets?
Inetd daemon
a.
What inetd is
b.
The server resource utilization issue, and how inetd solves it
c.
How inetd simplifies writing servers
Introduction to network security issues (optional as time permits)
a.
How the inetd daemon can be used with the TCP wrapper concept to provide
screening of clients
b.
How the TCP wrapper concept works
c.
Shortcomings of the TCP wrapper concept
Passing credentials and file descriptors (optional as time permits, or omit altogether -- this is
generally for advanced students only)
a.
User credentials
b.
How to get them locally, or to a local server
c.
How to send and receive user credentials
d.
How to send a file descriptor to another process on a local host
e.
How to receive a file descriptor from another process on a local host
Chabot College
Course Outline for Computer Science 18E
Linux Socket Programming II
Fall Semester 2002
Page 3
Methods of Presentation:
1.
2.
Lecture
In-class example programs with explanations and demonstrations
Assignments and Methods of Evaluating Student Progress:
1.
2.
Typical Assignments
a. Programming homework illustrating main points from lectures, such as:
1) A program using out-of-band data to communicate directly between sockets
independently of the main application messages.
2) A multi-client server and several servers to drive the client (or use clients written
by several different students).
b. Non-programming homework to reinforce concepts from lecture and reading
1) Write a timing diagram showing the sequence of operations that occur when
processing client messages from a concurrent client server.
2) Examine a set of IP addresses, showing which class they belong to and what
netmasks will cause them to be considered local subnet addresses.
Methods of Evaluating Student Progress
a.
Midterm Exam
b.
Optional short quizzes
c.
Final exam
Textbook(s) (Typical):
Linux Socket Programming by Example, Warren W. Gay, Que Corporation, 2000
Special Student Materials:
Computer lab fee
Diskettes
Optional zip disk
Revised: July 2001
Keith Mehl
CS 18E Outline Fall 2002
hps
Download