On Mon, Dec 08, 2008 at 08:46:36AM -0500, Steve Dickson wrote:
> typedef struct {
> char **hostname;
> struct sockaddr_in saddr;
> struct pmap pmap;
> } clnt_addr_t;
>
> Why isn't saddr a struct sockaddr instead of a struct sockaddr_in?
>
> It seems at the beginning of each routine saddr is always being
> typecast into a struct sockaddr pointer.... So wouldn't be easier
> and cleaner to simply make sadd a struct sockaddr or am I missing
> something?
I'm sure most people here know this, but still, be careful: If you ever
intend to store an IPv6 address somewhere, the field in the struct should be
a sockaddr_storage. sockaddr (or sockaddr_in, for that matter) is not big
enough to store a sockaddr_in6.
/* Steinar */
--
Homepage: http://www.sesse.net/