ATM Socket Program in Python: Code two separate programs: a client and a server
ID: 3924136 • Letter: A
Question
ATM Socket Program in Python:
Code two separate programs: a client and a server. The server balances and does all updates, i.e. deposits and withdrawals. The server will also respond when asked about the account balance. A user sends commands through the client, able to deposit money into their account, withdraw money from the same account, and check the balance of the account. No calculations are done via the client; the client only sends requests to the server, which executes whatever the request is and returns the answer to the client. The balance should be initialized to an X amount by the server.
Explanation / Answer
class MySocket: """demonstration class only - coded for clarity, not efficiency """ def __init__(self, sock=None): if sock is None: self.sock = socket.socket( socket.AF_INET, socket.SOCK_STREAM) else: self.sock = sock def connect(self, host, port): self.sock.connect((host, port)) def mysend(self, msg): totalsent = 0 while totalsentRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.