Andre Poenitz wrote:
> 
> On Fri, Oct 19, 2001 at 11:50:33AM +0200, Stephan Witt wrote:
> > 1.  Create the symlink on startup, use IP-Addr:Processnumber
> 
> How do you get "The IP-address" of some machine?
> This logic is flawed.

You need the IP-address of your own machine to
compare with the IP-address used in constructed symlink.

Some code (error checking ommitted) to get the own IP address:

char * GetIpAddress (void)
{
        struct utsname name ;
        struct hostent *hp ;
        struct in_addr in;

        uname(&name) ;
        hp = gethostbyname(name.nodename);
        (void) memcpy(&in.s_addr,*hp->h_addr_list,sizeof (in.s_addr));
        return inet_ntoa (in) ;
}

I know, this is not really robust. One have to use gethostbyname_r
to be reentrant, avoid inet_ntoa and so on. But the idea is like that.

Stephan

------------------------------------------------
<[EMAIL PROTECTED]> | beusen Solutions GmbH
fon: +49 30 549932-62    | Landsberger Allee 366
fax: +49 30 549932-21    | 12681 Berlin, Germany
------------------------------------------------

Reply via email to