Vous êtes sur la page 1sur 5

Objectives: With this project students should develop client-server application for hybrid file transfer system.

Client-server applications must support TCP protocol for command exchange and UDP protocol for data transferring. Recommendations & Rules: The application must be written in C/C++ . Application operates in multithread mode. (So application serve more than one user at a time) Dont use any special library for protocols when coding. Write your own functions if its necessary. Unless otherwise explicitly specified, all written assignments or code that is submitted is to be entirely the students own work. Using any code or copying any assignment from others is strictly prohibited without advance prior permission from the instructor. All students work is their own. Students who do share their work with others are as responsible for academic dishonesty as the student receiving the material. Students who encourage others to cheat or plagiarize, or students who are aware of plagiarism or cheating and do not report it are also participating in academically dishonest behavior. In this case (academically dishonest behavior), students to be punished with no grade. Project Details: a) Server Side 1) Server should bind (listen) port that defined in application configuration file. This port uses for authentication and command exchange purpose. All data exchange should use TCP transport layer protocol for reliability. 2) Server must have two configuration file (text file). One of them of these files includes configuration parameters of server. Another file should include login name and password details. Configuration files examples given at Appendix section. 3) Server application operates similar with FTP Servers. RFC 959 consist more detail for FTP. Following commands should be implemented. USER NAME (USER) PASSWORD (PASS) LIST (LIST) RETRIEVE (RETR) DELETE (DELE) SYSTEM (SYST) HELP (HELP) NOOP (NOOP) LOGOUT (QUIT) PORT (PORT)

CPE/ISE-432 Computer Network Design and Application Hybrid File Transfer System Project Details (Rev 2)

4) Working behavior shown below: After client initiate connection, server send welcome message to client. This typical message should looks like:

220 CIU File Transfer Server Ready After this greeting message client should give user and password information for authentication. Given values check from user-password file and if values are correct server show Login Successful message and client permitted to go further parts. In other condition Server gives Login not permitted message and gives three-time login attempt right to client.

USER test 331 Please specify the password. PASS test 230 Login successful. Or 500 Login not permitted If client was authenticated it is permitted to apply other commands.

HELP This command used to show system recognized commands. 214-The following commands are recognized. HELP LIST NOOP PWD QUIT RETR SYST PASS 214 Help OK. SYST This command used to show system type. 215 UNIX Type: L8 LIST This command used to retrieve user directory contents. 212 Directory status. index.html deneme.txt 212 Directory listing OK. NOOP This command used for check health of server! 200 NOOP ok. DELE <filename> This command is uses for remove file from server. 250 Requested file action okay, completed.

Foocmd There are no such or command like this name! 502 Command not implemented QUIT Used for quit (close) connection. 221 Goodbye. 5) How to client receive file from server? When client want to get file from server first its require to execute PORT command. When client execute PORT command server choose one of their service port that is use for data exchanging. Port number range should include in config file and server choose data transfer port from free port numbers and give this port number to client. If there are no any port number server should give error message to client. PORT 200 <Port number> Ready 200 2000 Ready or 405 0 Available port If server gives available port number Client should execute RETR command. If this command-executed client should connect that port number determined by Server before. And all data exchange from Server to client should use that connection. RETR <filename> This command has filename argument. And it uses for retrieve file contents from Server UDP port. There are three possibilities here: If there is no such file in this case Server should give error message: 503 Failed to open file. If PORT command not executed before RETR Server should give warning message to client. 504 Please execute PORT Command In last case probably everything okay so Server must bind determined port for data transfer and also give positive answer to client. 200 Data transfer Ready 6) How Client retrieves data from Server? This Client-Server system uses similar principles that defined in TFTP (RFC 1350). But not all features. UDP must be used as transport layer protocol. First Client must send file request message to start data transfer. This packet should like give following table

Request Package: 1 Byte String (must be limited length) Opcode Filename What are the fields values?
opcode values 1 Read request (RRQ) 2 Write request (WRQ) 3 Data (DATA) 4 Acknowledgment (ACK) 5 Error (ERROR) filename The name of the file to be read.

String #Octets

#octets The number of octets in a block, specified in ASCII. Valid values range between "8" and "1428" octets, inclusive. The blocksize refers to the number of data octets.

The reception of a data packet with a data length less than the negotiated block size is the final packet. If the blocksize is greater than the amount of data to be transfered, the first packet is the final packet. If the amount of data to be transfered is an integral multiple of the blocksize, an extra data packet containing no data is sent to end the transfer. Then server should give data (response) package to client. Data Package: 1 Byte N Bytes Opcode(DATA) Data Opcode is same as given above. All packets other than duplicate ACK' and those used for termination are acknowledged s unless a timeout occurs. Sending a DATA packet is an acknowledgment for the first ACK packet of the previous DATA packet. Acknowledge Package: 1 Byte Opcode(ACK) 2 Bytes Sizeof Data

Acknowledge package represented above. This package sends by client to acknowledge server that data package received. It contains Opcode and size of received data. When server get acknowledge package compare this size with kept value. If its correct it continue operation. If something is wrong, server should send error message to client. And break operation. Error Package: 1 Byte String Opcode(Error) Error Message

APPENDIX server.cfg: ----------------------------------------------------------------------------------------------------------------# This is Multiprotocol Server configuration file. Its have several attributes. # The lines begin with # accepted as comment line. # ListenIp defines listen ip address of application # If its defined as All its listen all ip address or if defined ip address its only listen this # ip address ListenIp=All # ListenPort defines listening port of application ListenPort=80 # ServerPortRange defines server data transfer ports and number. Its colon delimited ServerPortRange=2000:10 ----------------------------------------------------------------------------------------------------------------users.pwd # This file used by ftp server and structure shown below # Username:Password:Home Directory test:test: /home/test john:johnpass:/home/john tom:tompw:/tom alice:123321:/home/alice

Vous aimerez peut-être aussi