Ok so the error msg i get is
Code:
serversocket.bind((ip1, 21))
File "<string>", line 1, in bind
error: [Errno 10049] The requested address is not valid in its context
the issue is im not using the classic method of
Code:
host = socket.gethostname()
ip = socket.gethostbyname(host)
instead im getting the physical ip using
Code:
site = urllib.urlopen('http://checkip.dyndns.org').read()
ip1 = re.search("(\d+\.\d+\.\d+\.\d+)", site).group()
this gives me the above message during the socket.bind method and im unsure as to why.. is this just not recognized as one of the ip addresses of the computer? can it only run off the 192.168.x.x or 10.x.x.x
Code:
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#get ip Address
site = urllib.urlopen('http://checkip.dyndns.org').read()
#use regex to get just IP
ip1 = re.search("(\d+\.\d+\.\d+\.\d+)", site).group()
#bind socket to ip and port
serversocket.bind((ip1, 21))
#start listening for client requests
serversocket.listen(1)
clientsocket, address = serversocket.accept()