Hello,

I have just started socket programming.

I am having trouble understanding this line of code.

Code:
bind(int socket, struct sockaddr *address, int address_length);
I am using it like this:
Code:
bind(s, (struct sockaddr *)&sin, sizeof(sin));
I can understand the 1st and 3rd parameters, but can't understand the second.

Code:
(struct sockaddr *) &sin
My idea is that it is passing the &sin by reference and casting it to a pointer to a struct of sockaddr.

Correct me if I am wrong,

Any examples would be good for me.

Many thanks for your help,

Steve