Personal tools
You are here: Home Classes Fall 2004 - Spring 2005 CS 342 Programming Assignment 1 -- Computer Networks
Navigation
Log in


Forgot your password?
« July 2008 »
Su Mo Tu We Th Fr Sa
12345
6789101112
13141516171819
20212223242526
2728293031
 
Document Actions

Programming Assignment 1 -- Computer Networks

by admin last modified 2005-05-12 17:53
Programming Assignment 1 -- Remote File Query Server
Computer Networks
Spring, 2001
Due:  March 7 (midnight)

Write a connection-oriented client and server for the Internet family using sockets.  The server will accept queries about files contained in its local file system.  Clients can request information about the existence, contents, and other attributes of remote files.

The client.  The client should read from standard input a sequence of command lines.  Each line should be parsed into individual information requests, each of which is sent to the server.  For each request, the client waits for a response and, when the response is received, writes the response to standard output.

The client program is run from the following command line:

rfq [ hostname [ port number ] ]

Use the local host as the default host.  Use the RFQ_PORT defined below as the default port number.

A command line is in the form
 

options  filename [ filename filename ... ]


where options is a string of characters, with each character representing a type of information requested from the server.  The command is terminated by an end-of-line character.  The possible options are:

t        file type.  ( "n" = normal, "d" = directory  )

s        file size in bytes.

m       time of last modification.

d        display contents.  For a normal file, the server should simply read the file sequentially and pass it to the client, byte by byte.  For a directory, the server should pass a list of the names of files contained in the directory.

c        change directory.  This will affect how the server interprets relative pathnames.  It should be in effect only for this client session.

q        quit.
 

The server.  After accepting a connection from a client, the server receives one message at a time from its network input (socket) which represents a query for information about a file in the server's file system.  Messages should be in the form
 

options filename


If a requested file does not exist, or the server does not have the required permissions to perform the requested action, the server should return an error message to the client.

The server should listen on a port number defined in the server program, as in

#define RFQ_PORT  _________
 

Java programmers should use the File object to obtain information about a file.  C programmers should use the stat system call.
 

 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: