37 #include "boost/scoped_array.hpp"
43 namespace pexExceptions = lsst::pex::exceptions;
56 long int host_len = sysconf(_SC_HOST_NAME_MAX)+1;
58 std::vector<char> vec;
62 unsigned char a,
b,c,d;
64 if (gethostname(vec.data(), vec.size()) == 0) {
67 std::string msg(
"call to gethostname() failed");
68 throw LSST_EXCEPT(pexExceptions::RuntimeError, msg);
71 ent = (
struct hostent *)gethostbyname(
_hostname.c_str());
73 std::string msg(
"call to gethostbyname() failed");
74 throw LSST_EXCEPT(pexExceptions::RuntimeError, msg);
77 a = ent->h_addr_list[0][0] & 0xFF;
78 b = ent->h_addr_list[0][1] & 0xFF;
79 c = ent->h_addr_list[0][2] & 0xFF;
80 d = ent->h_addr_list[0][3] & 0xFF;
82 _IPAddr = (a << 24) | (b << 16) | (c << 8) | d;
std::string const & getHostName()
get the host name
static Host const & getHost()
get the Host object, which can access the host and ip address.
This object represents the host that is being used to transmit events, giving quick access to often-u...
static std::string _hostname
#define LSST_EXCEPT(type,...)
afw::table::Key< double > b
static unsigned int _IPAddr
unsigned int const getIPAddress()
get the IP address
Include files required for standard LSST Exception handling.