'Python UDP over internet without port forwarding
Trying to send some data over UDP from computer1 to computer2 without port forwarding. Can't find anything else than localhost stuff. Let's say sender and receiver know each other's ports and public IPs.
Is it even possible to do it?
Send
client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
message = b'sadasd'
addr = ("x.y.z.y", 6700)
client_socket.sendto(message, addr)
Receive
server_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server_socket.bind(('', 6700))
while True:
message, address = server_socket.recvfrom(1024)
print(address, "Sent ", message)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
