reflum,

On Thu, 2011-08-04 at 09:29 +0200, Robert Hegner wrote:
> Using SLPReg I'd like to register
> 
> service:TrackingNode.CP://192.168.0.100:1234
> 
> where the IP address should actually be the the local IP address of my 
> NIC. This sounds to me like a common problem when using SLP, but I 
> haven't found a solution yet.
> 
> The problem is that I haven't found a nice and portable way to discover 
> the local IP address (using gethostname and gethostbyname is ugly and 
> Windows specific, for example).
> 
> What is the common practice to register a service using the current IP 
> address?

This is a non-easy problem and I don't have a good solution for you.

Yet there are some points you should consider:
A lot systems (even my laptop) has multiple externel addresses plus
loopback address. In addition there is no 'eth0' so requesting the
address of hardcoded 'eth0' will fail on some systems (eth0 broke and I
replaced the card. As it is a new card it got a new name.)

looking up hostname (both gethostname() and uname()) works for me but
often people have use strange hostnames ('localhost'...) or hostnames
can not be resolved.

There can also be some kind of address translation in between (NAT,...)
which requires you to publish a IP address not your real one.

I think a good application should allow the user to give the address in
some kind of configuration file, dialog,...

I also think that plublishing hostnames (not IP addresses) solves some
(most) of the abo´ve problems. This should be prefered.


If you find a good solution please tell me. ;)


-- 
Philipp.
 (Rah of PH2)

Attachment: signature.asc
Description: This is a digitally signed message part

------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Openslp-users mailing list
Openslp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openslp-users

Reply via email to