The Nebula Device 3: Win360::Win360IpAddress Class Reference

The Nebula Device 3

Win360::Win360IpAddress Class Reference

#include <win360ipaddress.h>


Detailed Description

NOTE: Socket network communication on the Xbox360 is only provided for debugging and development purposes. For actual multiplayer and Xbox Live related stuff, use the Xbox-specific add-on modules! (which don't exist yet, ha).

Represents an IP address, consisting of a IPv4 host address and a port number. Performs automatic name lookup on the host name. Can extract address information from an URI and automatically converts host names to addresses, and offers the special hostnames "localhost", "any", "broadcast", "self" and "inetself" where:

  • "localhost" will translate to 127.0.0.1
  • "any" will translate to INADDR_ANY, which is 0.0.0.0
  • "broadcast" will translate to INADDR_BROADCAST, which is 255.255.255.255
  • "self" will translate to the first valid tcp/ip address for this host (there may be more then one address bound to the host)
  • "inetself" will translate to the first host address which is not a LAN address (which is not a class A, B, or C network) if none such exists the address will fall back to "self"

(C) 2007 Radon Labs GmbH

Public Member Functions

 Win360IpAddress ()
 default constructor
 Win360IpAddress (const Win360IpAddress &rhs)
 copy constructor
 Win360IpAddress (const IO::URI &uri)
 construct from URI
 Win360IpAddress (const Util::String &hostName, ushort portNumber)
 construct from host name and port number
bool operator== (const Win360IpAddress &rhs) const
 equality operator
bool operator< (const Win360IpAddress &rhs) const
 less-then operator
bool operator> (const Win360IpAddress &rhs) const
 greater-then operator
void ExtractFromUri (const IO::URI &uri)
 extract host name and port number from URI
void SetHostName (const Util::String &hostName)
 set host name
const Util::StringGetHostName () const
 get host name
void SetPort (ushort port)
 set port number
ushort GetPort () const
 get port number
const Util::StringGetHostAddr () const
 get the ip address resulting from the host name as string

Member Function Documentation

void Win360::Win360IpAddress::ExtractFromUri ( const IO::URI uri  ) 

extract host name and port number from URI

Extract the host name and optionally the port number from the provided URI. If no port number is set in the URI, the current port number will be left as is. If the host name is empty, it will be set to "localhost".

void Win360::Win360IpAddress::SetHostName ( const Util::String hostName  ) 

set host name

Set the host name, and immediately convert it to an ip address. This accepts the special hostnames "any", "broadcast", "localhost", "self" and "inetself". The result ip address can be returned in string form with the method GetAddrAsString().

const String & Win360::Win360IpAddress::GetHostName (  )  const

get host name

Get the host name.

void Win360::Win360IpAddress::SetPort ( ushort  port  ) 

set port number

Set the port number. Will be translated to network byte order internally.

ushort Win360::Win360IpAddress::GetPort (  )  const

get port number

Get the port number in host byte order.

const String & Win360::Win360IpAddress::GetHostAddr (  )  const

get the ip address resulting from the host name as string

Return the in address as string.