[Solved] : Assignment 2 : Simple Query Search & Retrieval Services

$25

File Name: :_Assignment_2_:_Simple_Query_Search_&_Retrieval_Services.zip
File Size: 536.94 KB

SKU: [Solved] : Assignment 2 : Simple ‘Query’ Search & Retrieval Services Category: Tag:
5/5 - (1 vote)

Aim

The objectives of this assignment includes:

  • Learning about process communication via sockets
  • Apply the concepts learnt by developing a client-server program simulating a country search directory services

Background

This assignment requires you to develop a client-server application using socket programming to simulate a simple query search and info retrieval service. The characteristics are as follows:

Server

Upon startup, the server program will read in a list of country data from a text file countries.txt, and store them in some data structure (e.g. array). Please refer to Appendix A, for a description of the fields in each line of record. Appendix B shows a sample of the contents in countries.txt file.

After storing all the country data records, the server program will then create a socket, bind it to an address, goes into an infinite loop to listen for and accept a connection request.

Upon receiving a connection request, the server is to create a new child process to handle the clients query. The child process will exit only when client indicates it is done searching for info, and the connection is then closed. While the child process is handling a particular clients query, the parent process should continue waiting and listening for other clients request for connection.

Appendix C shows an example of the server started in the background, with a message to confirm the startup status.

Client

Upon startup, the client program will create a socket and initiate a connection to the server. Once connection is established, it will prompt user for input (i.e. the name of the country), before sending over clients query.

Upon receiving servers response, the client needs to handle 2 main situations:

  • If the countrys data cannot be found, either because of mis-spelling in the query, or the country is non-existent, the client will output some error message to inform user
  • If the countrys record is found, the client will display some info about the country. (e.g. in Appendix D, the countrys capital city, and currency code are shown. However, you are not limited to display only these 2 fields. In fact, you can display whatever pieces of information that is available in countries.txt file read in by the server).
  • Finally, Appendix E shows a simple simulation of multiple connections from 2 client programs started in 2 shell terminals. While it is difficult to demonstrate processing of multiple requests simultaneously (you need more than a pair of quick hands to do that), your server should be programmed in such a way to accept and handle at least two or more connections.

Task Requirements

  1. Please take some time to study the contents in Appendices A E as they provide many useful information that could affect your programs design, (e.g. how you should store each line of a countrys data as a record).
  1. Before you start developing your program, you should take some time to review the output, and expected behavior, plan for basic error handling and analyze the requirements of the client-server socket application.
  1. It is recommended that you come up with some basic table of technical requirements to document what you interpret to be desired functionalities of the program, before you proceed with program development.
  1. Once the program is completed and tested to be working successfully, you are highly encouraged to add on new features to the program that you feel are relevant to the tasks of country directory searching services. Additional marks may be awarded subject to the relevancy and correctness of the new functionalities.

Deliverables

  • The deliverables include the following:
  1. The actual working client-server program (hard+soft copies), with comments on each file, function or block of code to help the tutor understand its purpose.
  1. A word document (hard+soft copies) that elaborates on:
    • (Interpreted) requirements of the client-sever program
    • Diagram / Illustrations of program design
    • Summary of implementation of each module in your program
    • Reflections on program development (e.g. assumptions made, difficulties faced, what could have been done better, possible enhancements in future, what have you learnt, etc)
  1. A program demo/evaluation during lab session. You must be prepared to perform certain tasks / answer any questions posed by the tutor.
  • IMPT: Please follow closely, to the submission instructions in Appendix F, which contains details about what to submit, file naming conventions, when to submit, where to submit, etc.
  • The evaluation will be held during lab session where you are supposed to submit your assignment. Some time will be allocated for you to present / demonstrate your program during the session.

APPENDIX A

(Description of fields in countries.txt file)

Length Type Description
Field 1 2 character Top Level Domain (TLD) code
Field 2 variable character Countrys name
Field 3 2 character Countrys code in FIPS104 standard
Field 4 2 character Countrys code in ISO2 standard
Field 5 3 character Countrys code in ISO3 standard
Field 6 variable number Countrys ISO number
Field 7 variable character Countrys capital name
Field 8 variable character Countrys region (e.g. Asia, Europe, etc)
Field 9 variable character Countrys currency name
Field 10 3 character Countrys currency code
Field 11 variable number Countrys population

APPENDIX B

(Sample contents in countries.txt file)

Note1 : Each field in the countrys record is delimited by the comma , character

Note2 : Countries name can be MORE THAN one word!

APPENDIX C

(Server startup)

Note : runServer is an executable shell script that executes the server program css. The ps command verifies that the server program is started as a background process

APPENDIX D

(Sample output illustrating behavior of client program)

APPENDIX E

(Sample output illustrating multiple client connections)

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] : Assignment 2 : Simple Query Search & Retrieval Services
$25