I am receiving the following warning
when compiling my client - server UDP socket
simulation:
warning: passing 'int *' to parameter of type 'socklen_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign]
This is the concerned code:
#define BUFLEN 2048
struct sockaddr_in myaddr, remaddr;
int fd, recvlen, slen=sizeof(remaddr);
...
char response[BUFLEN];
recvlen = recvfrom(fd, response, BUFLEN - 1, 0, (struct sockaddr *)&remaddr, &slen);
I have been referencing a tutorial from Rutgers university. I have a fair idea as to why this warning is occuring (it wants me to use socklen_t *
), but I wanted to ask the SO community.
- Why is this warning occuring?
- How can I get rid of it?