I'm trying to create a server-side application to listen for connections and call a method based on what the client says. However when I call the method upload i want to continue executing code under main.
Is there anyway i can achieve this, or am i taking the incorrect approach? Code below;
def main(ipAddr, tcpPort, bufferSize, s):
try:
s.bind((ipAddr, tcpPort))
s.listen(4)
conn, addr = s.accept()
print("Connection attempt from: %s" % addr)
messageRecv = ""
while True:
data = conn.recv(bufferSize)
if not data: break
messageRecv = data.decode('utf-8')
finally:
conn.close()
if messageRecv == "Ready": upload(addr)
main(ipAddr, tcpPort, bufferSize, s)
def upload(addr):
pass