Question: C Language Program Develop a bank client application (bankClient) that takes the following command line arguments and then communicates with the server to process the
C Language Program
Develop a bank client application (bankClient) that takes the following command line arguments and then communicates with the server to process the transaction:
bankClient servIPAddr servPortNum transaction acctnum value
servIPAddr is the IP address of the bank server servPortNum is the port number of the bank server transaction is {B for balance inquiry, D for deposit, or W for withdrawal} acctnum is the account number value is the value of the transaction in pennies (ignored for a balance inquiry)
The protocol between the client and server is simple: they exchange a single message type in either direction (the sBANK_PROTOCOL data structure seen below).
/* Bank Transaction Types */ #define BANK_TRANS_DEPOSIT 0 #define BANK_TRANS_WITHDRAW 1 #define BANK_TRANS_INQUIRY 2
typedef struct {
unsigned int trans; unsigned int acctnum; unsigned int value;
/* transaction type */ /* account number */ /* value */
} sBANK_PROTOCOL; The server responds in the following way to transaction requests from the client:
trans and acctnum are repeated from client message, value depends on the transaction.
For a deposit, the deposited value is set in the value field. For a withdrawal, if there is insufficient funds then a zero is set in the value field, otherwise the withdrawn amount is set in the value field.
For a balance inquiry, the balance of the account is set in the value field.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
