Changeset 11010 for trunk/FACT++/src


Ignore:
Timestamp:
06/11/11 00:30:18 (13 years ago)
Author:
tbretz
Message:
Set '192.168.0.255' as default address because it is a broadcast address.
Location:
trunk/FACT++/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/DimSetup.cc

    r11002 r11010  
    2525//! to the DIM dns.
    2626//!
     27//! The local IP address is necessary because in some circumstances
     28//! Dim needs the IP address of the connecting machine (DIM_HOST_NODE)
     29//! for the clients to correctly connect to them. So what we would
     30//! need is the IP address over which the machine is reachable from
     31//! the client. Unfortunately, we have no access to the client
     32//! connection, hence, we have to find the best guess of an address
     33//! which is not our own machine and hope it is routed over the
     34//! standard ethernet interface over which other clients will connect.
     35//!
     36//! To not send random packages over the network we use a local
     37//! IP address. To make sure it is something which leaves the network
     38//! card and is not just our machine, we can use a broadcast address.
     39//! Consequently, the deafult has been chosen to be "192.168.0.255"
     40//!
    2741//! @param dns
    2842//!     Address of the Dim-dns
     
    3145//!     The IP Address through which the connection to the DNS will
    3246//!     take place.
     47//!
     48//! @todo
     49//!     Implement a --host command line option (just in case)
    3350//!
    3451string Dim::GetLocalIp(const string &dns)
     
    143160void Dim::Setup(const std::string &dns)
    144161{
    145     setenv("DIM_DNS_NODE",  dns.c_str(),             1);
    146     setenv("DIM_HOST_NODE", GetLocalIp(dns).c_str(), 1);
     162    setenv("DIM_DNS_NODE",  dns.c_str(),               1);
     163    setenv("DIM_HOST_NODE", Dim::GetLocalIp().c_str(), 1);
    147164
    148165    cout << "Setting DIM_DNS_NODE=" << dns << endl;
     
    151168extern "C"
    152169{
    153     const char *GetLocalIp(const char *dns)
     170    const char *GetLocalIp()
    154171    {
    155         return Dim::GetLocalIp(dns).c_str();
     172        return Dim::GetLocalIp().c_str();
    156173    }
    157174}
  • trunk/FACT++/src/DimSetup.h

    r11004 r11010  
    66namespace Dim
    77{
    8     std::string GetLocalIp(const std::string &dns);
     8    std::string GetLocalIp(const std::string &dns="192.168.0.255");
    99    void Setup(const std::string &dns);
    1010}
  • trunk/FACT++/src/dns.c

    r11005 r11010  
    11#include <stdlib.h>
    22
    3 extern const char *GetLocalIp(const char *dns);
     3extern const char *GetLocalIp();
    44
    55int local_main(int argc, char **argv);
     
    77int main(int argc, char **argv)
    88{
    9     setenv("DIM_HOST_NODE", GetLocalIp("172.0.0.0"), 1);
     9    setenv("DIM_HOST_NODE", GetLocalIp(), 1);
    1010
    1111    return local_main(argc, argv);
Note: See TracChangeset for help on using the changeset viewer.