PingForAndroid icon indicating copy to clipboard operation
PingForAndroid copied to clipboard

socket error: Permission denied!

Open DoSeek opened this issue 5 years ago • 1 comments

`

  client_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP);

if (client_fd == -1)

{

    printf("socket error: %s!\n", strerror(errno));

    return ret;

}

` test on CentOS7, Ubutun 18.04, throw exception: [myk@sz Test]$ ./ping www.baidu.com socket error: Permission denied! ping result: -1

even though use 'sudo': [myk@sz Test]$ sudo ./ping www.baidu.com [sudo] password for myk: socket error: Permission denied! ping result: -1

DoSeek avatar Sep 18 '19 09:09 DoSeek

Have a try for socket(AF_INET, SOCK_RAW, IPPROTO_ICMP). You need to assemble the ICMP package yourself.

bgylde avatar Nov 28 '19 07:11 bgylde