Here's the declaration of SystemAddress, I propose adding one or more additional constructors to help keep user code clean.
struct RAK_DLL_EXPORT SystemAddress
{
// these constructors would be helpful in cases where you are just creating one for the sake of passing it to a function
// like: sendsomethingto (SystemAddress("127.0.0.1",10000))
SystemAddress(const char *str, unsigned short); // something like this
///The peer address from inet_addr.
unsigned int binaryAddress;
///The port number
unsigned short port;
// Return the systemAddress as a string in the format <IP>:<Port>
// Note - returns a static string. Not thread-safe or safe for multiple calls per line.
char *ToString(bool writePort=true) const;
// Sets the binary address part from a string. Doesn't set the port
void SetBinaryAddress(const char *str);
SystemAddress& operator = ( const SystemAddress& input )
{
binaryAddress = input.binaryAddress;
port = input.port;
return *this;
}
bool operator==( const SystemAddress& right ) const;
bool operator!=( const SystemAddress& right ) const;
bool operator > ( const SystemAddress& right ) const;
bool operator < ( const SystemAddress& right ) const;
};