Any one could describe how (struct sockaddr *)&server works here? Is it possible to cast bigger struct to smaller struct?
(struct sockaddr *)&server
See these structs:
This is refered as Type Punning. Here, both structures have the same size, so there is no question of struct size. Although you can cast almost anything to anything, doing it with structures is error-prone.