So I got the connection timed out error (error 110)
This is the IP address I got from ipconfig /all:

And this is the code I use for client (the RasPi): import socket
TCP_IP = '192.168.2.52'
TCP_PORT = 5005
BUFFER_SIZE = 1024
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host,port)) #this is where the error came in
s.send(message)
data = s.recv(BUFFER_SIZE)
s.close()
print("Received data: ", data)
This is the code I have for the host computer:
import socket
TCP_IP = ''
TCP_PORT = 5005
BUFFER_SIZE = 1024
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((TCP_IP, TCP_PORT))
s.listen(1)
conn, addr = s.accept()
print ('Connection address:', addr)
while 1:
data = conn.recv(BUFFER_SIZE)
if not data: break
print ("received data:", data)
conn.send(data) # echo
conn.close()
Both of the devices are connected to the same network, but I have been tinkering around for the last couple of hours but still failed to get a connection between the 2.
Any idea? Seems like a pretty basic snippet of code. Thanks!