diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /contrib/libs/poco/Net/src/NTPEventArgs.cpp | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'contrib/libs/poco/Net/src/NTPEventArgs.cpp')
-rw-r--r-- | contrib/libs/poco/Net/src/NTPEventArgs.cpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/contrib/libs/poco/Net/src/NTPEventArgs.cpp b/contrib/libs/poco/Net/src/NTPEventArgs.cpp new file mode 100644 index 0000000000..21c57b8779 --- /dev/null +++ b/contrib/libs/poco/Net/src/NTPEventArgs.cpp @@ -0,0 +1,71 @@ +// +// NTPEventArgs.cpp +// +// Library: Net +// Package: NTP +// Module: NTPEventArgs +// +// Implementation of NTPEventArgs +// +// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/Net/NTPEventArgs.h" +#include "Poco/Net/SocketAddress.h" +#include "Poco/Net/DNS.h" +#include "Poco/Exception.h" +#include "Poco/Net/NetException.h" + + +using Poco::IOException; +using Poco::InvalidArgumentException; + + +namespace Poco { +namespace Net { + + +NTPEventArgs::NTPEventArgs(const SocketAddress& address): + _address(address), _packet() +{ +} + + +NTPEventArgs::~NTPEventArgs() +{ +} + + +std::string NTPEventArgs::hostName() const +{ + try + { + return DNS::resolve(_address.host().toString()).name(); + } + catch (HostNotFoundException&) + { + } + catch (NoAddressFoundException&) + { + } + catch (DNSException&) + { + } + catch (IOException&) + { + } + return _address.host().toString(); +} + + +std::string NTPEventArgs::hostAddress() const +{ + return _address.host().toString(); +} + + +} } // namespace Poco::Net |