IPV4 socket address class. More...

#include "murl_system_socket_address.h"

Public Member Functions

 SocketAddress ()
 The default constructor. More...
 
 SocketAddress (const SocketAddress &socketAddress)
 The copy constructor. More...
 
SocketAddressoperator= (const SocketAddress &socketAddress)
 Assignment operator. More...
 
 SocketAddress (const String &hostName)
 Constructor setting the ip-address by SetHostName(). More...
 
 SocketAddress (UInt32 ipAddress)
 Constructor setting the ip-address by SetIpAddress(). More...
 
virtual ~SocketAddress ()
 The destructor.
 
Bool SetIpAddress (UInt32 ipAddress) const
 Set the ip-address. More...
 
Bool SetPortNumber (UInt16 portNumber) const
 Set the port number. More...
 
Bool SetToAnyAddress () const
 Set to the any ip-address (0.0.0.0). More...
 
Bool SetToBroadcastAddress () const
 Set to the broadcast ip-address (255.255.255.255). More...
 
Bool SetToLoopBackAddress () const
 Set to the loopback ip-address (127.0.0.1). More...
 
String SetResolveHostName (const String &hostName) const
 Set the ip-address by resolving a host name. More...
 
UInt32 GetIpAddress () const
 Get the ip-address. More...
 
UInt16 GetPortNumber () const
 Get the port number. More...
 
String GetDotNotation () const
 Get the dot notation string of the ip-address. More...
 
String GetDotPortNotation () const
 Get the dot notation string of the ip-address and the port. More...
 
String GetHostName () const
 Get the host name by resolving the ip-address. More...
 
UInt32 GetNetworkIpAddress () const
 Get the ip-address in network format. More...
 
void SetNetworkIpAddress (UInt32 networkIp) const
 Set the ip-address in network format. More...
 
UInt16 GetNetworkPortNumber () const
 Get the port number in network format. More...
 
void SetNetworkPortNumber (UInt16 networkPort) const
 Set the port number in network format. More...
 

Protected Attributes

SocketAddressHandle * mHandle
 The anonymous socket address handle for internal use only.
 

Detailed Description

IPV4 socket address class.

Platform independent low-level abstraction of the Berkeley socket api. Several methods are blocking calls when waiting for network response.

(!) Do not use this class directly in the logic code. Use Net::ISocketClient and Net::ISocketServer interfaces instead.

Constructor & Destructor Documentation

◆ SocketAddress() [1/4]

Murl::System::SocketAddress::SocketAddress ( )

The default constructor.

Initializes with any ip-address, see SetToAnyAddress().

◆ SocketAddress() [2/4]

Murl::System::SocketAddress::SocketAddress ( const SocketAddress socketAddress)

The copy constructor.

Parameters
socketAddressThe SocketAddress object to copy.

◆ SocketAddress() [3/4]

Murl::System::SocketAddress::SocketAddress ( const String hostName)

Constructor setting the ip-address by SetHostName().

Parameters
hostNameThe host name.

◆ SocketAddress() [4/4]

Murl::System::SocketAddress::SocketAddress ( UInt32  ipAddress)

Constructor setting the ip-address by SetIpAddress().

Parameters
ipAddressThe ip-address in host format.

Member Function Documentation

◆ operator=()

SocketAddress& Murl::System::SocketAddress::operator= ( const SocketAddress socketAddress)

Assignment operator.

Parameters
socketAddressThe SocketAddress object to copy.
Returns
The object itself.

◆ SetIpAddress()

Bool Murl::System::SocketAddress::SetIpAddress ( UInt32  ipAddress) const

Set the ip-address.

The ip-address host format is 0xaabbccdd for "aaa.bbb.ccc.ddd".

Parameters
ipAddressThe ip-address in host format.
Returns
true if successful.

◆ SetPortNumber()

Bool Murl::System::SocketAddress::SetPortNumber ( UInt16  portNumber) const

Set the port number.

Parameters
portNumberThe port number.
Returns
true if successful.

◆ SetToAnyAddress()

Bool Murl::System::SocketAddress::SetToAnyAddress ( ) const

Set to the any ip-address (0.0.0.0).

Returns
true if successful.

◆ SetToBroadcastAddress()

Bool Murl::System::SocketAddress::SetToBroadcastAddress ( ) const

Set to the broadcast ip-address (255.255.255.255).

Returns
true if successful.

◆ SetToLoopBackAddress()

Bool Murl::System::SocketAddress::SetToLoopBackAddress ( ) const

Set to the loopback ip-address (127.0.0.1).

Returns
true if successful.

◆ SetResolveHostName()

String Murl::System::SocketAddress::SetResolveHostName ( const String hostName) const

Set the ip-address by resolving a host name.

An empty string resolves the local host.

Parameters
hostNameThe host name. The host name can be specified by the domain name or the dot notation e.g. "127.0.0.1". If the host name is empty, the local ip-address is used.
Returns
The host name or an empty string if resolving failed.

◆ GetIpAddress()

UInt32 Murl::System::SocketAddress::GetIpAddress ( ) const

Get the ip-address.

The ip-address host format is 0xaabbccdd for "aaa.bbb.ccc.ddd".

Returns
The ip-address in host format.

◆ GetPortNumber()

UInt16 Murl::System::SocketAddress::GetPortNumber ( ) const

Get the port number.

Returns
The port number.

◆ GetDotNotation()

String Murl::System::SocketAddress::GetDotNotation ( ) const

Get the dot notation string of the ip-address.

Returns
The dot notation string of the ip-address.

◆ GetDotPortNotation()

String Murl::System::SocketAddress::GetDotPortNotation ( ) const

Get the dot notation string of the ip-address and the port.

Returns
The dot notation string of the ip-address and the port.

◆ GetHostName()

String Murl::System::SocketAddress::GetHostName ( ) const

Get the host name by resolving the ip-address.

Returns
The resolved host name or the dot notation if resolving failed.

◆ GetNetworkIpAddress()

UInt32 Murl::System::SocketAddress::GetNetworkIpAddress ( ) const

Get the ip-address in network format.

Returns
The ip-address in network format.

◆ SetNetworkIpAddress()

void Murl::System::SocketAddress::SetNetworkIpAddress ( UInt32  networkIp) const

Set the ip-address in network format.

Parameters
networkIpThe ip-address in network format.

◆ GetNetworkPortNumber()

UInt16 Murl::System::SocketAddress::GetNetworkPortNumber ( ) const

Get the port number in network format.

Returns
The port number in network format.

◆ SetNetworkPortNumber()

void Murl::System::SocketAddress::SetNetworkPortNumber ( UInt16  networkPort) const

Set the port number in network format.

Parameters
networkPortThe port number in network format.

The documentation for this class was generated from the following file:
  • murl_system_socket_address.h


Copyright © 2011-2024 Spraylight GmbH.