Investigating multi threading programming using TCP sockets Assignment
- Country :
Australia
Goal:
investigate multi threading programming using TCP sockets
Description:
You are required to implement a multi-threaded client/server bank application that responds to TCP requests. The server will accept TCP requests on a port which is passed as an argument in the command line when starting the server. To pass the port, you need to use service name rather than port number (see below).
Server-Side:
The server implements a bank application that provide the following services:
- Create an account (account number is generated by the server and returned to the client)
- Delete an account (the user enters the account number)
- List the number of accounts created so far (the server can create up to MAX ACCOUNTS)
- Display balance for some account (the user enters the account number)
- Deposit some amount into an account (the user enters the account number and the deposit amount)
- Withdraw some amount from an account (the user enters the account number and the withdraw amount)
Each of these services should be implemented in a separate thread. That is, when a client connects, the server creates a thread to server that specific client. That thread creates a new thread for each request sent from that client. This new thread should perform the requested service and return appropriate result is back to the client. In the case an error occurred, the error should be returned to the client also.
The server should not allow the number of accounts to exceed the value of MAX ACCOUNTS. For this assignment define MAX-ACCOUNTS to be 5. In addition, cach account number is composed of two digits. So valid account numbers are between 10 and 15.
The list of accounts and balances are kept on the server on some file, called accounts.txt. this file is loaded when the server starts, and saved every 5 seconds to the file in case the server crashed for some reason.
To run the server, you need to specify the service name (rather than the port number) on the command line. To so, you need to edit the /etc/services in your server machine and add a line that specifies the port name as bank port and assign it some value based on your students ID. To avoid conflict when working on the course server, each student is required to use a port number for the server using the following format: 55abe for its connection, where abe is the least significant 3 digits of your students ID. For example, a student whose ID is 12345 will have the server listening port 55345
Client-Side:
Once the client starts, it displays a menu for the user to select services from as follows:
- Create an account
- Delete an account
- List number of accounts (customers)
- Display balance for some account
Are you struggling to keep up with the demands of your academic journey? Don't worry, we've got your back! Exam Question Bank is your trusted partner in achieving academic excellence for all kind of technical and non-technical subjects.
Our comprehensive range of academic services is designed to cater to students at every level. Whether you're a high school student, a college undergraduate, or pursuing advanced studies, we have the expertise and resources to support you.
To connect with expert and ask your query click here Exam Question Bank