I am teaching myself socket programming in C. I understand how to do the stuff I need to get sockets working and cummunicating. My question is more about how something underlying works.
in most socket functions you have to cast your address structure to a generic pointer to a sockaddr struct.
My question is how does the definition for the sockaddr struct work and what does the compiler do when it comes upon this "(struct sockaddr *)sockaddr_*"
I have looked at socket.h and I find this a transparent union... I dont understand much of the transparent union but I am trying to see how that union can be used to cast different size/variable size address structures to a generic sockaddr struct.
Any one have an idea?