added +int Socket::bindToIfceAddr()
This commit is contained in:
@ -308,6 +308,20 @@ int Socket::bind (const SocketAddress& target) QSE_CPP_NOEXCEPT
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Socket::bindToIfceAddr (const qse_mchar_t* ifce, qse_uint16_t port) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
SocketAddress addr;
|
||||
if (this->getIfceAddress(ifce, &addr) <= -1) return -1;
|
||||
return this->bind(addr);
|
||||
}
|
||||
|
||||
int Socket::bindToIfceAddr (const qse_wchar_t* ifce, qse_uint16_t port) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
SocketAddress addr;
|
||||
if (this->getIfceAddress(ifce, &addr) <= -1) return -1;
|
||||
return this->bind(addr);
|
||||
}
|
||||
|
||||
int Socket::listen (int backlog) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
QSE_ASSERT (this->handle != QSE_INVALID_SCKHND);
|
||||
|
@ -85,6 +85,7 @@
|
||||
# define FAMILY(x) (-1)
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
/////////////////////////////////
|
||||
QSE_BEGIN_NAMESPACE(QSE)
|
||||
/////////////////////////////////
|
||||
@ -128,6 +129,17 @@ void SocketAddress::setIpaddr (const qse_ip4ad_t* ipaddr) QSE_CPP_NOEXCEPT
|
||||
#endif
|
||||
}
|
||||
|
||||
void SocketAddress::setIpaddr (const qse_uint32_t ipaddr) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
#if defined(AF_INET)
|
||||
if (FAMILY(&this->skad) == AF_INET)
|
||||
{
|
||||
struct sockaddr_in* v4 = (struct sockaddr_in*)&this->skad;
|
||||
v4->sin_addr.s_addr = ipaddr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SocketAddress::setIpaddr (const qse_ip6ad_t* ipaddr) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
#if defined(AF_INET6)
|
||||
|
Reference in New Issue
Block a user