IP_HDRINCL protocol not available

Viewed 21

Iam new to network programing (raw socket). I want to send syn packet. But i run this code I got an error like this:

Error setting IP_HDRINCL: Protocol not available

//IP_HDRINCL to tell the kernel that headers are included in the packet
int one = 1;
const int *val = &one;

if (setsockopt (s, IPPROTO_IP, IP_HDRINCL, val, sizeof (one)) < 0)
{
    perror("Error setting IP_HDRINCL");
    exit(0);
}
0 Answers
Related