On Sun, Mar 7, 2010 at 8:02 AM, james anderson james.anderson@setf.dewrote:
good evening;
i asked chun tian about this some while ago and he didn't think it was necessary as the 0.0.0.0 address suffices for most purposes.
Yes, for listening for messages, the 0.0.0.0 is quite sufficient.
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.
I'm wondering if there is any way to determine the local host address (or
addresses) used when I create a socket with :local-host *wildcard-host* . When I try to call get-local-address on such a socket, I just get #(0 0 0 0).
Thanks.
You could go ahead and create a trivial-get-network-interfaces library that uses, say, ifconfig on Linux and ipconfig/all on Windows, parses the results and memoizes them, and makes them available with a simple interface. Make it very slim to increase the likelyhood that someone else will add code for other platforms. You'll need a portable run-shell-command library. There is one, but I forgot the name.
-Hans
On Sun, Mar 7, 2010 at 20:36, Elliott Slaughter elliottslaughter@gmail.com wrote:
On Sun, Mar 7, 2010 at 8:02 AM, james anderson james.anderson@setf.de wrote:
good evening;
i asked chun tian about this some while ago and he didn't think it was necessary as the 0.0.0.0 address suffices for most purposes.
Yes, for listening for messages, the 0.0.0.0 is quite sufficient. 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.
I'm wondering if there is any way to determine the local host address (or addresses) used when I create a socket with :local-host *wildcard-host* . When I try to call get-local-address on such a socket, I just get #(0 0 0 0).
Thanks.
-- 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
usocket-devel mailing list usocket-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/usocket-devel
good evening;
On 2010-03-07, at 20:36 , Elliott Slaughter wrote:
On Sun, Mar 7, 2010 at 8:02 AM, james anderson james.anderson@setf.de 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.
1.3 has conditionalized code for solaris, windows, and everything else. do take a look. you might even be in luck.
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 wonder if you could use zeroconf/bonjour? It sounds like your application might be a good fit. There's a reference to a CL interface at http://www.cliki.net/CL-ZEROCONF (though I don't know how complete/portable it is).
On Mon, Mar 8, 2010 at 10:50 AM, R. Matthew Emerson rme@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 wonder if you could use zeroconf/bonjour? It sounds like your application
might be a good fit. There's a reference to a CL interface at http://www.cliki.net/CL-ZEROCONF (though I don't know how complete/portable it is).
I knew about Bonjour but didn't know about the CL interface for it. From looking around the source, it isn't obvious what it depends on (e.g. does it need Bonjour to be installed on the system?), although I did find a todo note saying it doesn't run on Windows yet.