Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I want the code written in C please Description: You will implement a client/server multi-threaded bank application that responds to TCP requests. The services provided
I want the code written in C please
Description: You will implement a client/server multi-threaded bank application that responds to TCP requests. The services provided by the server include (displayed as a menu to the client): 1. Create an account ( account number is generated by the server and returned to the client) 2. Delete an account 3. List the number of accounts (the server can create up to MAX_ACCOUNTS) 4. Display balance for some account 5. Deposit some amount into an account 6. Withdraw some amount from an account Your server should wait for requests on some port provided on the command line. In addition, you need to use server name and service name in your code rather that its IP address and port number. That is, you need to edit the /etc/hosts file in your client machine and add a line that specifies the server name as nes411_file_server and assign it the IP address of your server machine. Also, you need to edit the /etc/services in your client machine and add a line that specifies the port name as atmp and assign it the value 24053. Your code you should use the appropriate functions to convert between hostnames/IP addresses and service/port. See the man page of the files for more information The client program should be composed of two threads. One displays the menu, reads user input, and sends request to the servers. The other reads response from server and display result on the terminal. On the other hand, the server is multithreaded such that each client is handled by a thread. In addition, the server should not allow the number of accounts to exceed the value of MAX_ACCOUNTS. Note that more than one client can connect to the server at the same time. That is, each thread is doing a specific request for a specific client. Accounts numbers are two digits. As a result, the MAX-ACCOUNTS variable is limited to 100 in this case. The list of accounts and balances are kept on the server on some file. The server need to make sure that this list is loaded when start running the server, and frequently saved to the file in case the server crashed for some reason. The client when sending a request should indicate request type and any other parameters required (such as account number in some operation). Furthermore, the client should output to the user informative results ( not just throwing numbers on the screen) Your client program should display a menu to the user to select from as following: 1. Create an account 2. Delete an account 3. List number of customers ( accounts ) 4. Display balance for some account 5. Deposit from an account 6. Deposit into an account 7. Exit Once an option is entered by the user, the service is performed, and then the user is presented with the menu again. This operation is repeated until the user selects Exit option. Note that options 2, 4, 5, 6 requires the user to enter a valid account number. For option one, the server chooses one of the available numbers and assign it to the newly created account. Hints: 0 Ask questions as early as possible. O DO NOT use the header file "unp.h from the book Submit your source code one zipped file according to the naming rules Your programs should be compiled and run without any single error or warning. Comment and error-check you code O NO CHEATING/COPYING Your program for the client needs to take two arguments that specify the hostname and the service name of the server. Your program for server needs to take an argument that specifies the service name to work on Don't use the bind() function on the clients Test your code by running the three clients simultaneously. . Description: You will implement a client/server multi-threaded bank application that responds to TCP requests. The services provided by the server include (displayed as a menu to the client): 1. Create an account ( account number is generated by the server and returned to the client) 2. Delete an account 3. List the number of accounts (the server can create up to MAX_ACCOUNTS) 4. Display balance for some account 5. Deposit some amount into an account 6. Withdraw some amount from an account Your server should wait for requests on some port provided on the command line. In addition, you need to use server name and service name in your code rather that its IP address and port number. That is, you need to edit the /etc/hosts file in your client machine and add a line that specifies the server name as nes411_file_server and assign it the IP address of your server machine. Also, you need to edit the /etc/services in your client machine and add a line that specifies the port name as atmp and assign it the value 24053. Your code you should use the appropriate functions to convert between hostnames/IP addresses and service/port. See the man page of the files for more information The client program should be composed of two threads. One displays the menu, reads user input, and sends request to the servers. The other reads response from server and display result on the terminal. On the other hand, the server is multithreaded such that each client is handled by a thread. In addition, the server should not allow the number of accounts to exceed the value of MAX_ACCOUNTS. Note that more than one client can connect to the server at the same time. That is, each thread is doing a specific request for a specific client. Accounts numbers are two digits. As a result, the MAX-ACCOUNTS variable is limited to 100 in this case. The list of accounts and balances are kept on the server on some file. The server need to make sure that this list is loaded when start running the server, and frequently saved to the file in case the server crashed for some reason. The client when sending a request should indicate request type and any other parameters required (such as account number in some operation). Furthermore, the client should output to the user informative results ( not just throwing numbers on the screen) Your client program should display a menu to the user to select from as following: 1. Create an account 2. Delete an account 3. List number of customers ( accounts ) 4. Display balance for some account 5. Deposit from an account 6. Deposit into an account 7. Exit Once an option is entered by the user, the service is performed, and then the user is presented with the menu again. This operation is repeated until the user selects Exit option. Note that options 2, 4, 5, 6 requires the user to enter a valid account number. For option one, the server chooses one of the available numbers and assign it to the newly created account. Hints: 0 Ask questions as early as possible. O DO NOT use the header file "unp.h from the book Submit your source code one zipped file according to the naming rules Your programs should be compiled and run without any single error or warning. Comment and error-check you code O NO CHEATING/COPYING Your program for the client needs to take two arguments that specify the hostname and the service name of the server. Your program for server needs to take an argument that specifies the service name to work on Don't use the bind() function on the clients Test your code by running the three clients simultaneouslyStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started