'How to use a proxy list with socket in python to ping a ip?

I am using python and socket, I want to use a proxy list, but I am not estbalishing a http connection(Or am I??), but I am using it to ping a ip, I would like to know how to use proxies to ping a ip with another ip?

def ping(ip):
        port = 80
        udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
        data = random._urandom(65500)
        udp.sendto(data, (ip, port))
        wait = input()```


Solution 1:[1]

don't put random ports
each proxy has his own port that you should use
at least that what worked for me

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Oussema Ameur