CNetChan: Getters improvements

* Allow for requesting address base only.
* Added new getter 'GetPort'.
This commit is contained in:
Kawe Mazidjatari 2023-04-30 01:24:45 +02:00
parent 78a86fed6a
commit 4ec8e67d9b
2 changed files with 13 additions and 3 deletions

View File

@ -28,9 +28,18 @@ const char* CNetChan::GetName(void) const
// Purpose: gets the netchannel address
// Output : const char*
//-----------------------------------------------------------------------------
const char* CNetChan::GetAddress(void) const
const char* CNetChan::GetAddress(bool onlyBase) const
{
return this->remote_address.ToString();
return this->remote_address.ToString(onlyBase);
}
//-----------------------------------------------------------------------------
// Purpose: gets the netchannel port in host byte order
// Output : int
//-----------------------------------------------------------------------------
int CNetChan::GetPort(void) const
{
return int(ntohs(this->remote_address.GetPort()));
}
//-----------------------------------------------------------------------------

View File

@ -81,7 +81,8 @@ class CNetChan
{
public:
const char* GetName(void) const;
const char* GetAddress(void) const;
const char* GetAddress(bool onlyBase = false) const;
int GetPort(void) const;
int GetDataRate(void) const;
int GetBufferSize(void) const;