15 #include "netAddress.h"
16 #include "config_net.h"
62 return _addr.
set_host(
"127.0.0.1", port);
84 return _addr.
set_host(hostname, port);
150 nassertr(n >= 0 && n < 4, 0);
152 const PN_uint8 *ip = (
const PN_uint8 *)&ip_long;
173 output(ostream &out)
const {
194 return _addr == other._addr;
204 return _addr != other._addr;
bool set_any(int port)
Sets the address up to refer to a particular port, but not to any particular IP.
bool set_any_IP(int port)
Set to any address and a specified port.
bool set_broadcast(int port)
Sets the address to the broadcast address.
PN_uint8 get_ip_component(int n) const
Returns the nth 8-bit component of the IP address.
const Socket_Address & get_addr() const
Returns the Socket_Address for this address.
void set_port(int port)
Resets the port number without otherwise changing the address.
unsigned short get_port() const
Get the port portion as an integer.
void clear()
Resets the NetAddress to its initial state.
bool set_host(const string &hostname, int port)
Sets the address up to refer to a particular port on a particular host.
PN_uint32 get_ip() const
Returns the IP address to which this address refers, as a 32-bit integer, in host byte order...
NetAddress()
Constructs an unspecified address.
bool set_localhost(int port)
Sets the address up to refer to a particular port, on this host.
void clear()
Set the internal values to a suitable known value.
int get_port() const
Returns the port number to which this address refers.
A simple place to store and munipulate tcp and port address for communication layer.
unsigned long GetIPAddressRaw() const
Return a RAW sockaddr_in.
bool set_host(const std::string &hostname, int port)
This function will take a port and string-based TCP address and initialize the address with this info...
string get_ip_string() const
Returns the IP address to which this address refers, formatted as a string.
std::string get_ip() const
Return the IP address portion in dot notation string.
bool set_broadcast(int port)
Set to the broadcast address and a specified port.
Represents a network address to which UDP packets may be sent or to which a TCP socket may be bound...
bool set_port(int port)
Set to a specified port.