I have a simple programs for socket client and server its not working over internet
# Echo server program
import socket
import ImageGrab
HOST = '' # Symbolic name meaning all available interfaces
PORT = 3000 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
print 'Connected by', addr
data = conn.recv(1024)
print data
conn.close()
# Echo client program
import socket
import ImageGrab
#destnation ip
HOST = '127.0.0.1' # The remote host
PORT = 3000 # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.send('Hello rushikesh')
s.close()
print 'Received'#, repr(data)
When we try to make it work over internet it is not able to connect. Program is shown as above only thing is destination ip is replaces by my friends ip.
When working over localhost it works perfectly fine but not working over internet ...
I have written program using SOCK_DGRAM
it works over internet only for small chunks of data. I want to transmit image using it so I have written it using SOCK_STREAM
for transmitting image which successfully worked on localhost and was not working over internet. So I did write simplest program but still showing same problem
Can somebody please guid me through this...