Finished implementing, now for the testing phase.
This commit is contained in:
@@ -33,8 +33,8 @@ namespace ehs
|
||||
{
|
||||
}
|
||||
|
||||
TCP::TCP(const AddrType addrType)
|
||||
: BaseTCP(addrType), hdl(EHS_INVALID_SOCKET)
|
||||
TCP::TCP(const IP IP)
|
||||
: BaseTCP(IP), hdl(EHS_INVALID_SOCKET)
|
||||
{
|
||||
TCP::Initialize();
|
||||
}
|
||||
@@ -90,9 +90,9 @@ namespace ehs
|
||||
return;
|
||||
}
|
||||
|
||||
if (addrType == AddrType::IPV6)
|
||||
if (IP == IP::V6)
|
||||
hdl = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
|
||||
else if (addrType == AddrType::IPV4)
|
||||
else if (IP == IP::V4)
|
||||
hdl = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
else
|
||||
return;
|
||||
@@ -142,9 +142,9 @@ namespace ehs
|
||||
if (!IsValid() || bound || connection)
|
||||
return;
|
||||
|
||||
if (addrType == AddrType::IPV6)
|
||||
if (IP == IP::V6)
|
||||
Bind_v6(address, port);
|
||||
else if (addrType == AddrType::IPV4)
|
||||
else if (IP == IP::V4)
|
||||
Bind_v4(address, port);
|
||||
|
||||
this->localAddr = address;
|
||||
@@ -178,7 +178,7 @@ namespace ehs
|
||||
UInt_32 addrLen = sizeof(sockaddr_in6);
|
||||
|
||||
TCP* client = new TCP();
|
||||
client->addrType = addrType;
|
||||
client->IP = IP;
|
||||
client->localAddr = localAddr;
|
||||
client->localPort = localPort;
|
||||
client->connection = true;
|
||||
@@ -244,18 +244,18 @@ namespace ehs
|
||||
remoteHostName = address;
|
||||
remotePort = port;
|
||||
|
||||
if (addrType == AddrType::IPV6)
|
||||
if (IP == IP::V6)
|
||||
{
|
||||
if (IsIPv6Only())
|
||||
remoteAddr = DNS::Resolve(AddrType::IPV6, address);
|
||||
remoteAddr = DNS::Resolve(IP::V6, address);
|
||||
else
|
||||
remoteAddr = DNS::Resolve(address);
|
||||
|
||||
Connect_v6(remoteAddr, port);
|
||||
}
|
||||
else if (addrType == AddrType::IPV4)
|
||||
else if (IP == IP::V4)
|
||||
{
|
||||
remoteAddr = DNS::Resolve(AddrType::IPV4, address);
|
||||
remoteAddr = DNS::Resolve(IP::V4, address);
|
||||
|
||||
Connect_v4(remoteAddr, port);
|
||||
}
|
||||
@@ -359,7 +359,7 @@ namespace ehs
|
||||
|
||||
void TCP::SetIPv6Only(const bool value)
|
||||
{
|
||||
if (addrType != AddrType::IPV6)
|
||||
if (IP != IP::V6)
|
||||
{
|
||||
EHS_LOG_INT(LogType::WARN, 0, "Cannot set IPv6 only mode while socket is not using IPv6.");
|
||||
return;
|
||||
@@ -383,7 +383,7 @@ namespace ehs
|
||||
|
||||
bool TCP::IsIPv6Only() const
|
||||
{
|
||||
if (addrType != AddrType::IPV6)
|
||||
if (IP != IP::V6)
|
||||
return false;
|
||||
|
||||
if (!IsValid())
|
||||
|
Reference in New Issue
Block a user