0% found this document useful (0 votes)
55 views2 pages

Lab Project PRG650-NBBL

The document describes a shopping solution project that has both client-side and server-side components. The server-side is a console application that initializes products with random quantities, creates accounts, and handles client commands by sending appropriate responses. The client-side is a Windows Forms application that allows users to log in, view available products, make purchases, and view order history by communicating with the server through a defined protocol.

Uploaded by

Ishrar G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views2 pages

Lab Project PRG650-NBBL

The document describes a shopping solution project that has both client-side and server-side components. The server-side is a console application that initializes products with random quantities, creates accounts, and handles client commands by sending appropriate responses. The client-side is a Windows Forms application that allows users to log in, view available products, make purchases, and view order history by communicating with the server through a defined protocol.

Uploaded by

Ishrar G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PRG650-NBBL LAB PROJECT

Marks: 12 Due: Week 15, December 11

Develop a shopping solution that has both client side and server side.

Server-side

• A console application should be enough, it prints each response to the output window before
sending back to the client-side(s).
• When it first runs, at least five pre-defined products with random quantities (1-3) should be
initialized. Which means products should be the same every time the server starts, and the
quantities for each product should be randomized.
• At least 3 accounts should be created, each account has an account number and user’s name.
• When the server is active, it should store ordering information to variable(s) (e.g., dictionaries,
lists). The server does not have to store the ordering information to the local system, so once
you shutdown the server, all information can be disposed.
• Server should send back appropriate response depending on the client’s command. (Protocol
below)
• The handler code should be separated from the user interface (i.e., in a separate class — similar
to the examples available on the blackboard).
• The server must be able to talk with multiple clients at the same time
Client-side

• The client-side should be a Windows Forms application, with an appropriate user interface. The
user can select one product, then make the purchase. (quantity as one)
• When it first opens, a login form should appear with two input fields: hostname/IP and the
account number. (localhost as the default value for the hostname)
• If the server cannot be found, the application should display an error message; if the server is
active but login failed, a different error message should be displayed.
• Once the user successfully connected to the server, the application should get all products
information (names and quantities), then show all information on the GUI.
• The user must be able to gracefully disconnect from the server. Upon disconnecting, the
application should close. The application should gracefully disconnect when the form is closed.
• When the user making the purchase, if the product is not available, the application should
display an appropriate message stating that the product is no longer available.
• The application should be able to show current purchase orders.
• The server handler code should be separated from the user interface (i.e., in a separate class —
similar to the examples on the blackboard).
Protocol standard for this project:

Client Command Server Response


No response.
DISCONNECT
The server removes the client from the list of active clients. Both sides end the connection.
CONNECTED:user_name
The client has successfully connected with the specified account number. The server
CONNECT:account_no returns the connected client's name.
CONNECT_ERROR
The client's connection attempt is unsuccessful. The account_no is not valid.
PRODUCTS: product_name1,quantity1|product_name2,quantity2|…
The server sends all product information (e.g. PRODUCTS:APPLE,2|ORANGE,1).
GET_PRODUCTS
NOT_CONNECTED
The client is not currently connected.
ORDERS:product_name1,quantity1,user_name|product_name2,quantity2, user_name|…
The server sends the purchase orders of the current client.
GET_ORDERS (e.g. ORDERS:APPLE,1,John|ORANGE,1,Doe).
NOT_CONNECTED
The client is not currently connected.
The product_name argument is one of the product names from the GET_PRODUCTS
response.
NOT_AVAILABLE
The product is not available (i.e., is already purchased by another client) and cannot be
PURCHASE:product_name purchase.
NOT_VALID
The specified product is not valid.
NOT_CONNECTED
The client is not currently connected.

You might also like