network
Struct CSocketAddress
in SocketBase.h
in SocketBase.cpp
- struct CSocketAddress
A protocol-independent representation of a socket address. All protocols
in the ESocketProtocol enum should have a corresponding member in this union.
Constructor Summary |
inline CSocketAddress()
|
CSocketAddress( u8 address[ 4], int port )
Create an address from a numerical IPv4 address and port, port in local
byte order, IPv4 address as a byte array in written order. |
explicit CSocketAddress( int port, ESocketProtocol proto = IPv4 )
Create a wildcard address for the specified protocol with a specified
port. |
Method Summary |
int |
GetPort() const
Returns the port number part of the address |
inline ESocketProtocol |
GetProtocol() const
|
CStr |
GetString() const
Returns the string representation of the address, i. |
static CSocketAddress |
Loopback( int port, ESocketProtocol proto = IPv4 )
|
static PS_RESULT |
Resolve( const char* name, int port, CSocketAddress& addr )
Resolve the name using the system name resolution service (i.e. DNS) and
store the resulting address. |
m_Union
public CSocketAddress::anonymous_union_1 m_Union;
CSocketAddress
public inline CSocketAddress();
CSocketAddress
public CSocketAddress( u8 address[ 4], int port );
- Create an address from a numerical IPv4 address and port, port in local
byte order, IPv4 address as a byte array in written order. The Protocol
of the resulting SocketAddress will be IPv4
- Parameters:
address
- An IPv4 address as a byte array (in written order)
port
- A port number (0-65535) in local byte order.
CSocketAddress
public explicit CSocketAddress( int port, ESocketProtocol proto = IPv4 );
- Create a wildcard address for the specified protocol with a specified
port.
- Parameters:
port
- The port number, in local byte order
proto
- The protocol to use; default IPv4
GetPort
public int GetPort() const;
- Returns the port number part of the address
GetProtocol
public inline ESocketProtocol GetProtocol() const;
GetString
public CStr GetString() const;
- Returns the string representation of the address, i.e. the IP (v4 or v6)
address. Note that the port is not included in the string (mostly due to
the fact that the port representation differs wildly between address
families, and that Resolve does not take port as part of the hostname)
Loopback
public static CSocketAddress Loopback( int port, ESocketProtocol proto = IPv4 );
Resolve
public static PS_RESULT Resolve( const char* name, int port, CSocketAddress& addr );
- Resolve the name using the system name resolution service (i.e. DNS) and
store the resulting address. When multiple addresses are found, the
first result is returned.
Note that this call will block until the name resolution attempt is
either completed successfully or timed out.
- Parameters:
name
- The name to resolve
addr
- A reference to the variable to hold the address
- Returns:
- The result of the operation