I've a simple UDP python server set up on my computer which I'd like to access from over the internet. I want to open a port and forward data to my python server but I can't get it to open for some reason. I use this site which says the port is closed despite having port forwarded. https://www.yougetsignal.com/tools/open-ports/.
Here's a screenshot of my router settings
I can access the server locally.
import socket
localIP = "192.168.1.106"
localPort = 8080
bufferSize = 1024
msgFromServer = "Hello UDP Client"
bytesToSend = str.encode(msgFromServer)
UDPServerSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
UDPServerSocket.bind((localIP, localPort))
print("UDP server up and listening")
while(True):
bytesAddressPair = UDPServerSocket.recvfrom(bufferSize)
message = bytesAddressPair[0]
address = bytesAddressPair[1]
clientMsg = "Message from Client:{}".format(message)
clientIP = "Client IP Address:{}".format(address)
print(clientMsg)
print(clientIP)
UDPServerSocket.sendto(bytesToSend, address)
Website says it doesn't work
question from:
https://stackoverflow.com/questions/65893091/port-forwarding-to-a-python-udp-server-not-working 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…