Skip to content
Snippets Groups Projects
Commit 25b1d908 authored by Dixon Tirtayadi's avatar Dixon Tirtayadi
Browse files

Added client code

parent 7dc82523
No related branches found
No related tags found
No related merge requests found
# Client to send lock / unlock to servers
class Client:
def __init__(self, server_ips) -> None:
self.server_ips = server_ips
# Returns true if lock is successful, false otherwise
# x : value to lock (int)
def lock(self, x) -> bool:
json = {"op": "lock", "value": x}
for server_ip in self.server_ips:
pass
# Send JSON to servers, will be treated as command
# Wait for response to return
# Returns true if unlock is successful, false otherwise
# x : value to lock (int)
def unlock(self, x) -> bool:
json = {"op": "unlock", "value": x}
for server_ip in self.server_ips:
pass
# Send JSON to servers, will be treated as command
# Wait for response to return
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment