7 #ifndef G3D_NetAddress_h
8 #define G3D_NetAddress_h
57 explicit NetAddress(
const std::string& hostnameAndPort);
87 return ntohl(addr.sin_addr.s_addr);
92 return ntohs(addr.sin_port);
107 std::ostream&
operator<<(std::ostream& os,
const NetAddress&);
113 return static_cast<size_t>(key.
ip() + (
static_cast<G3D::uint32>(key.
port()) << 16));
SOCKADDR_IN addr
Definition: NetAddress.h:30
bool ok() const
Returns true if this is not an illegal address.
Definition: NetAddress.cpp:175
Definition: NetAddress.h:39
bool operator!=(const NetAddress &a, const NetAddress &b)
Definition: NetAddress.h:128
Definition: HashTrait.h:105
Dynamic 1D array tuned for performance.
Definition: Array.h:95
NetAddress()
Definition: NetAddress.cpp:46
Definition: NetAddress.h:18
static std::string localHostname()
void init(uint32 host, uint16 port)
Definition: NetAddress.cpp:50
static void localHostAddresses(Array< NetAddress > &array)
Definition: NetAddress.cpp:135
bool operator==(const NetAddress &a, const NetAddress &b)
Definition: NetAddress.h:123
uint16_t uint16
Definition: g3dmath.h:166
uint32 ip() const
Returns a value in host format (i.e., don't worry about endian issues)
Definition: NetAddress.h:86
static size_t hashCode(const G3D::NetAddress &key)
Definition: NetAddress.h:112
Abstraction of network (socket) functionality.
Definition: NetworkDevice.h:608
std::string ipString() const
Definition: NetAddress.cpp:180
uint16 port() const
Definition: NetAddress.h:91
std::string hostname() const
void serialize(class BinaryOutput &b) const
Definition: NetAddress.cpp:158
static NetAddress broadcastAddress(uint16 port)
Creates a UDP broadcast address for use with a G3D::LightweightConduit.
Definition: NetAddress.cpp:108
std::ostream & operator<<(std::ostream &os, const NetAddress &)
Definition: NetworkDevice.cpp:26
Definition: BinaryOutput.h:52
std::string toString() const
Definition: NetAddress.cpp:185
Definition: NetworkDevice.h:407
uint32_t uint32
Definition: g3dmath.h:168
Definition: NetworkDevice.h:168
void deserialize(class BinaryInput &b)
Definition: NetAddress.cpp:164