net/IPv4Address: add method GetPortBE()
This commit is contained in:
parent
868f1a4431
commit
c30466b84a
@ -187,11 +187,18 @@ public:
|
|||||||
return address.sin_family != AF_UNSPEC;
|
return address.sin_family != AF_UNSPEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the port number in network byte order
|
||||||
|
*/
|
||||||
|
constexpr uint16_t GetPortBE() const noexcept {
|
||||||
|
return address.sin_port;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the port number in host byte order
|
* @return the port number in host byte order
|
||||||
*/
|
*/
|
||||||
constexpr uint16_t GetPort() const noexcept {
|
constexpr uint16_t GetPort() const noexcept {
|
||||||
return FromBE16(address.sin_port);
|
return FromBE16(GetPortBE());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user