On the client side I have the main code and a class. If I call the foo function in the class, it sends some data to the server, it processes it and sends it back to the class. My question is that how can I return that data to the main code?
Here is my class:
def foo(self, a, b, c):
dataj = {"t": "t",
"data": {
"a": a,
"b": b,
"c": c
}}
self.__client_socket.send(json.dumps(dataj).encode())
def __receive_data(self):
while True:
data = self.__client_socket.recv(1024)
data = json.loads(data.decode("utf-8"))
if data["a"] == "b":
#return data to main code
Main code:
data = a.foo(1, 2, 3)