I have created a basic client server socket program in Python 2.7.x and it is running absolutely fine over the same network even on different machines but when I run server and client on different networks(server on my friend's network while client on mine) it does not return any error and keeps on waiting. I just can't understand how to debug the code. I am using port 80 by killing all the services on port 80. I have also done port forwarding on port 80 on both the machines.
My codes is as follows:
client.py
import socket
s = socket.socket()
host = '103.47.59.130'
port = 80
s.connect((host, port))
while True:
print "From Server: ", s.recv(1024) #This gets printed after sometime
s.send(raw_input("Client please type: "))
s.close()
server.py
import socket
s = socket.socket() # Create a socket object
host = '192.168.0.104' #private ip address of machine running fedora
port = 80
s.bind((host, port))
s.listen(5)
c, addr = s.accept()
print 'Got connection from', addr #this line never gets printed
while True:
c.send(raw_input("Server please type: "))
print "From Client: ", c.recv(1024)
c.close()
It sometimes output **From Server: ** but doesnot send any message back and forth.
PS: I have searched on Stack Overflow earlier but I am unable to find anything relevant.