added Socket::getSockName() and Socket::getPeerName()
This commit is contained in:
parent
6130d3cdfe
commit
95a41ab8a1
@ -60,6 +60,9 @@ public:
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
int getSockName (SocketAddress& addr) QSE_CPP_NOEXCEPT;
|
||||
int getPeerName (SocketAddress& addr) QSE_CPP_NOEXCEPT;
|
||||
|
||||
int getOption (int level, int optname, void* optval, qse_sck_len_t* optlen) QSE_CPP_NOEXCEPT;
|
||||
int setOption (int level, int optname, const void* optval, qse_sck_len_t optlen) QSE_CPP_NOEXCEPT;
|
||||
|
||||
|
@ -152,6 +152,24 @@ void Socket::close () QSE_CPP_NOEXCEPT
|
||||
}
|
||||
}
|
||||
|
||||
int Socket::getSockName (SocketAddress& addr) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
QSE_ASSERT (qse_is_sck_valid(this->handle));
|
||||
qse_sck_len_t len = addr.getAddrCapa();
|
||||
int n = ::getsockname(this->handle, (struct sockaddr*)addr.getAddrPtr(), &len);
|
||||
if (n == -1) this->setErrorCode (syserr_to_errnum(errno));
|
||||
return n;
|
||||
}
|
||||
|
||||
int Socket::getPeerName (SocketAddress& addr) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
QSE_ASSERT (qse_is_sck_valid(this->handle));
|
||||
qse_sck_len_t len = addr.getAddrCapa();
|
||||
int n = ::getpeername(this->handle, (struct sockaddr*)addr.getAddrPtr(), &len);
|
||||
if (n == -1) this->setErrorCode (syserr_to_errnum(errno));
|
||||
return n;
|
||||
}
|
||||
|
||||
int Socket::getOption (int level, int optname, void* optval, qse_sck_len_t* optlen) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
QSE_ASSERT (qse_is_sck_valid(this->handle));
|
||||
|
Loading…
Reference in New Issue
Block a user