Hello, I'm pretty new to network programming and I'm trying to communicate between two computers on the same network using sockets in Python.
I've learned about sockets and how to use them but for some reason, I couldn't make this thing work.
I tried doing this on the same computer with two different Python IDEs and it worked, but when I tried to do this on two different computers it didn't.
What I have tried:
Server side
import socket
s = socket.socket()
host, port = socket.gethostname(), 12345
s.bind((host, port))
s.listen(5)
c, addr = s.accept()
c.send("Thank you for connecting to my server")
c.close()
Client side
import socket
s = socket.socket()
host, port = socket.gethostname(), 12345
s.connect((host, port))
print(s.recv(1024)
Please help me to solve this, thanks in advance.