0
votes

I get the warning: passing argument 2 of ‘accept’ from incompatible pointer type [-Wincompatible-pointer-types]

Why am I getting this error?

        if(s = accept(ls, &client_address, &client_address_len)<0);
        {
            perror("Error: accepting failed!!");
            exit(1);
        }
1
How is client_address defined? - dbush

1 Answers

1
votes

According to https://pubs.opengroup.org/onlinepubs/009695399/functions/accept.html, the second argument of accept function receives a type of struct sockaddr *. You might want to do a conversion: &client_address to (struct sockaddr *)&client_address