Closed mmcd closed 9 years ago
import socket
google = "73.194.219.106" addrPort = "8000" wsPort = "8001"
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect((google,80)) ip = s.getsockname()[0] s.close()
addr = "http://" + ip + ":" + addrPort + "/" wsAddr = "ws:/" + ip + ":" + wsPort + "/"
print("addr: " + addr) print("wsAddr: " + wsAddr)
we have already solved this via the bootstrap. And this code does not give us an IP if you are behind NAT.
The current default config utilizes it.
import socket
google = "73.194.219.106" addrPort = "8000" wsPort = "8001"
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect((google,80)) ip = s.getsockname()[0] s.close()
addr = "http://" + ip + ":" + addrPort + "/" wsAddr = "ws:/" + ip + ":" + wsPort + "/"
print("addr: " + addr) print("wsAddr: " + wsAddr)