address.cpp
Go to the documentation of this file.00001
00002
00005 #include "../../stdafx.h"
00006
00007 #ifdef ENABLE_NETWORK
00008
00009 #include "address.h"
00010 #include "host.h"
00011
00012 const char *NetworkAddress::GetHostname() const
00013 {
00014 if (this->hostname != NULL) return this->hostname;
00015
00016 in_addr addr;
00017 addr.s_addr = this->ip;
00018 return inet_ntoa(addr);
00019 }
00020
00021 uint32 NetworkAddress::GetIP()
00022 {
00023 if (!this->resolved) {
00024 this->ip = NetworkResolveHost(this->hostname);
00025 this->resolved = true;
00026 }
00027 return this->ip;
00028 }
00029
00030 #endif