I am trying to create a socket on python that requires administrator privileges. I keep getting this error though:
error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions
I have tried implementing solutions on this website, concluding that it is probably an administrator error. One of the most notable is the code marked as the best answer to this question. However, even after implementing it in my code, after I tell UAC to allow the elevation, I still get the same error. Any review on my code below would be much appreciated.
if not admin.isUserAdmin():
admin.runAsAdmin()
icmp = socket.getprotobyname("icmp")
# Create Socket
try:
mySocket = socket.socket(socket.AF_INET, socket.SOCK_RAW, icmp)