[fpc-pascal]getting my local ip

ron wilson ron.wilson at coastgames.com
Thu Mar 14 23:09:27 CET 2002


im having difficulty getting my ip from within a winsock program.  this is
mainly due to my inability to understand this:

    type
       hostent = record
          { official name of host  }
          h_name: pchar;
          { alias list  }
          h_aliases: ^pchar;
          { host address type  }
          h_addrtype: SmallInt;
          { length of address  }
          h_length: SmallInt;
          { list of addresses  }
          case byte of
             0: (h_addr_list: ^pchar);
             1: (h_addr: ^pchar)
       end;

how do i understand the case statement?  what does 'case byte of' refer to?
in all the c examples i have read, they indicate that h_addr_list should
contain an array of addresses for the host, i.e. me.  however, the length of
this list is always 4 bytes, which is only one address, and it's always the
same as h_addr, both pointing to the loopback address.  the c examples all
use h_addr_list as an array.  why isn't this an array here?  im seriously
confused.

can anybody help me out?  i need to know my modem's ip address so that i can
instruct other people to connect to that address.  its kind of a pain to
always have to run ipconfig.  my users won't like that, and i shouldn't have
to teach them to do that if i can just divine the address within my program.

regards,
ron wilson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20020314/82939ab7/attachment.html>


More information about the fpc-pascal mailing list