I am running a simple client/server model, and I've come with a minimum reproducible example of my code to show what my problems are.
Here is my server:
import pickle
import socket
PORT = 9001
server = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
server .bind(("", PORT))
server .listen()
print("Waiting for connection...")
while True:
client_socket, address = server .accept()
print(client_socket)
print(f"connection from {address} as been established")
message_dict = {
'TYPE': 'MESSAGE',
'VALUE': 'welcome to server'
}
client_socket.send(pickle.dumps(message_dict))
client_socket.close() # close the client
Here is my TINY client:
import pickle
import socket
SERVER_IP = 'HERE IS MY IPV6 ADDRESS' # It's actually here, I just left it out for privacy
PORT = 9001
client = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
client.connect((SERVER_IP, PORT))
while True:
message = pickle.loads(client.recv(10000))
print(message)
break
The SPECIFIC error I get on my laptop is a timeout error, as if it's not finding the server hosting.
Why is it I can't use this code on my laptop? For instance I want to run the server on my home PC, and run this client code on my laptop. I got it working once upon a time, but I seem to have forgotten how I did it, thanks for your help. It works on my local machine