Update app_client.py - small modification so that client will quit if init connection cannot be established. TODO - be able to self quit when connection drops in the middle
This commit is contained in:
parent
a6c558e9a1
commit
7ac56db90d
@ -33,9 +33,10 @@ def create_request(action, value):
|
||||
def start_connection(host, port, request):
|
||||
addr = (host, port)
|
||||
print("starting connection to", addr)
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
# sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock = socket.create_connection(addr)
|
||||
sock.setblocking(False)
|
||||
sock.connect_ex(addr)
|
||||
# sock.connect_ex(addr)
|
||||
events = selectors.EVENT_READ | selectors.EVENT_WRITE
|
||||
message = libclient.Message(sel, sock, addr, request)
|
||||
sel.register(sock, events, data=message)
|
||||
|
Loading…
x
Reference in New Issue
Block a user