[usocket-devel] Announcing ip-interfaces (was: Re: Determining the local host address from wildcard host)

Elliott Slaughter elliottslaughter at gmail.com
Sun Mar 21 17:27:51 UTC 2010


On Mon, Mar 8, 2010 at 12:08 PM, Elliott Slaughter <
elliottslaughter at gmail.com> wrote:

> On Mon, Mar 8, 2010 at 10:50 AM, R. Matthew Emerson <rme at clozure.com>wrote:
>
>>
>> On Mar 7, 2010, at 2:36 PM, Elliott Slaughter wrote:
>>
>> > What I am actually trying to do is to search for other nodes on the
>> local network which are also running my application. My idea was to
>> construct one or more broadcast addresses, send UDP packets to each of them,
>> and listen for responses. This may not be the best way to go about this (and
>> suggestions would be appreciated), but if I choose this route, I would want
>> to know the IP address of each of the interfaces together with its subnet
>> mask.
>> >
>> > On 2010-03-07, at 07:20 , Elliott Slaughter wrote:
>> >
>> > if you really need this, you might look at the implementation for
>> %get-ip-interfaces in clozure.
>> > it uses getifaddrs in a fairly transparent manner, so, if you're
>> unix-based, you should be ok with it.
>> >
>> > I need this to work on Windows and *nix, which is why I can't use IOlib
>> or other Unix-based solutions. That said, Clozure does run on Windows, so
>> hopefully the code you mentioned has already been ported.
>>
>> There's an internal function ccl::%get-ip-interfaces that's
>> conditionalized for a bunch of platforms.  I can't really recommend that you
>> use it, of course, but it might be something to look at.
>>
>
> I glanced over the source briefly, and might give porting it to CFFI a shot
> when I can find some free time.
>

I've ported the code to CFFI, and tested on SBCL, CCL, ECL, and Allegro on
Mac OS X, SBCL on Linux, and SBCL on Windows. The source code is available
as a darcs repository at:

http://common-lisp.net/~eslaughter/darcs/ip-interfaces/

The code is licensed under the LLGPL to maximize license compatibility with
Clozure CL.

-- 
Elliott Slaughter

"Don't worry about what anybody else is going to do. The best way to predict
the future is to invent it." - Alan Kay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/usocket-devel/attachments/20100321/5bd13c3a/attachment.html>


More information about the usocket-devel mailing list