[usocket-devel] Determining the local host address from wildcard host

Tobias C. Rittweiler tcr at freebits.de
Sun Mar 7 11:52:27 UTC 2010


Elliott Slaughter writes:

> On Sat, Mar 6, 2010 at 10:44 PM, Hans Hübner <hans.huebner at gmail.com> wrote:
>
>> Elliott,
>>
>> to my knowledge, usocket does not provide an API to get a list of all
>> network interfaces, which is what you need to do if you want to know
>> the local IP address(es).
>>
>> One quick workaround is to invoke ifconfig and parse the output.  I
>> know that this is not a very satisfying or portable approach, but it
>> is quick.
>>
>
> Thanks. I wanted to make sure I wasn't missing something.
>
> Supposing that I wanted to find a more portable solution, would I need to
> write a custom CFFI wrapper over gethostbyname or getaddrinfo? And would
> this sort of functionality be considered for inclusion in usocket?

That seems more appropriate for IOLIB's socket interface.

  -T.





More information about the usocket-devel mailing list