binding sockets and pointer types

G

Guillaume Yziquel

Hello all.

I wish to bind a socket with the following code:
if (bind(s, (struct sockadrr *) serversocket, sizeof(serversocket)) != 0) {
perror("Failed to bind the server socket to a file.");
exit(1);
};

where serversocket is declared with
struct sockaddr_un serversocket;

At compile-time, I get:
main.c:29: warning: passing argument 2 of ´bind´ from incompatible pointer type.

I do not really understand how to get rid of this warning.

Guillaume.
 
R

Richard Tobin

Guillaume Yziquel said:
if (bind(s, (struct sockadrr *) serversocket, sizeof(serversocket)) != 0) {

Assuming this is cut-and-pasted from your program, the problem is that
you have misspelled "sockaddr" as "sockadrr".

-- Richard
 
G

Guillaume Yziquel

Richard Tobin a écrit :
Assuming this is cut-and-pasted from your program, the problem is that
you have misspelled "sockaddr" as "sockadrr".

You assumed right. Thank you: that was the last thing I were to think of...

Guillaume.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top