Changeset 11010 for trunk/FACT++/src
- Timestamp:
- 06/11/11 00:30:18 (13 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/DimSetup.cc
r11002 r11010 25 25 //! to the DIM dns. 26 26 //! 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 //! 27 41 //! @param dns 28 42 //! Address of the Dim-dns … … 31 45 //! The IP Address through which the connection to the DNS will 32 46 //! take place. 47 //! 48 //! @todo 49 //! Implement a --host command line option (just in case) 33 50 //! 34 51 string Dim::GetLocalIp(const string &dns) … … 143 160 void Dim::Setup(const std::string &dns) 144 161 { 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); 147 164 148 165 cout << "Setting DIM_DNS_NODE=" << dns << endl; … … 151 168 extern "C" 152 169 { 153 const char *GetLocalIp( const char *dns)170 const char *GetLocalIp() 154 171 { 155 return Dim::GetLocalIp( dns).c_str();172 return Dim::GetLocalIp().c_str(); 156 173 } 157 174 } -
trunk/FACT++/src/DimSetup.h
r11004 r11010 6 6 namespace Dim 7 7 { 8 std::string GetLocalIp(const std::string &dns );8 std::string GetLocalIp(const std::string &dns="192.168.0.255"); 9 9 void Setup(const std::string &dns); 10 10 } -
trunk/FACT++/src/dns.c
r11005 r11010 1 1 #include <stdlib.h> 2 2 3 extern const char *GetLocalIp( const char *dns);3 extern const char *GetLocalIp(); 4 4 5 5 int local_main(int argc, char **argv); … … 7 7 int main(int argc, char **argv) 8 8 { 9 setenv("DIM_HOST_NODE", GetLocalIp( "172.0.0.0"), 1);9 setenv("DIM_HOST_NODE", GetLocalIp(), 1); 10 10 11 11 return local_main(argc, argv);
Note:
See TracChangeset
for help on using the changeset viewer.