[ee122] question about slide 23 of Sockets ppt
jortiz at cs.berkeley.edu
Sat Sep 15 15:59:50 PDT 2007
host->h_addr_list is a pointer of type char*. So we have to cast
it to a pointer of type in_addr_t* type. After the cast, it's still
just a pointer to an in_addr_t. So then we have to dereference it to
get the value.
On 9/15/07, Davide Cerri <davide.cerri at gmail.com> wrote:
> i am trying to follow the code provided, but i get confused by this line
> in_addr_t server_addr = *(in_addr_t *) host->h_addr_list;
> why are we casting and de referencing instead of casting (in_addr_t)
> what kind of magic does this trick?
> ~/Davide Cerri
> ee122 mailing list
> ee122 at mailman.ICSI.Berkeley.EDU
More information about the ee122