Fixed SSL and TCP Bind.

This commit is contained in:
2025-05-22 07:05:11 -07:00
parent f52afe9c92
commit fbd8464043
5 changed files with 52 additions and 16 deletions

View File

@@ -385,6 +385,24 @@ namespace ehs
return result;
}
void TCP::SetReuse(const bool &value)
{
if (!IsValid())
{
EHS_LOG_INT(LogType::WARN, 1, "Attempted to set address and port reuse while socket is not initialized.");
return;
}
const int result = (int)value;
if (setsockopt(hdl, SOL_SOCKET, SO_REUSEPORT, &result, sizeof(int)) == -1)
{
EHS_LOG_INT(LogType::ERR, 2, "Failed to set address and port reuse with error #" + Str_8::FromNum(errno) + ".");
return;
}
EHS_LOG_SUCCESS();
}
bool TCP::IsValid() const
{
return hdl != EHS_INVALID_SOCKET;