diff --git a/daemon/core/resolver.hpp b/daemon/core/resolver.hpp
new file mode 100644
index 0000000..bd61f10
--- /dev/null
+++ b/daemon/core/resolver.hpp
@@ -0,0 +1,191 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NFD_CORE_RESOLVER_H
+#define NFD_CORE_RESOLVER_H
+
+#include "common.hpp"
+#include "core/global-io.hpp"
+#include "core/time.hpp"
+#include "core/scheduler.hpp"
+
+namespace nfd {
+namespace resolver {
+
+typedef function<bool (const boost::asio::ip::address& address)> AddressSelector;
+
+struct AnyAddress {
+  bool
+  operator()(const boost::asio::ip::address& address)
+  {
+    return true;
+  }
+};
+
+struct Ipv4Address {
+  bool
+  operator()(const boost::asio::ip::address& address)
+  {
+    return address.is_v4();
+  }
+};
+
+struct Ipv6Address {
+  bool
+  operator()(const boost::asio::ip::address& address)
+  {
+    return address.is_v6();
+  }
+};
+
+} // namespace resolver
+
+template<class Protocol>
+class Resolver
+{
+public:
+  struct Error : public std::runtime_error
+  {
+    Error(const std::string& what) : std::runtime_error(what) {}
+  };
+
+  typedef function<void (const typename Protocol::endpoint& endpoint)> SuccessCallback;
+  typedef function<void (const std::string& reason)> ErrorCallback;
+
+  typedef boost::asio::ip::basic_resolver< Protocol > resolver;
+
+  /** \brief Asynchronously resolve host and port
+   *
+   * If an address selector predicate is specified, then each resolved IP address
+   * is checked against the predicate.
+   *
+   * Available address selector predicates:
+   *
+   * - resolver::AnyAddress()
+   * - resolver::Ipv4Address()
+   * - resolver::Ipv6Address()
+   */
+  static void
+  asyncResolve(const std::string& host, const std::string& port,
+               const SuccessCallback& onSuccess,
+               const ErrorCallback& onError,
+               const nfd::resolver::AddressSelector& addressSelector = nfd::resolver::AnyAddress(),
+               const time::Duration& timeout = time::seconds(4.0))
+  {
+    shared_ptr<Resolver> resolver =
+      shared_ptr<Resolver>(new Resolver(onSuccess, onError,
+                                        addressSelector));
+
+    resolver->asyncResolve(host, port, timeout, resolver);
+    // resolver will be destroyed when async operation finishes or global IO service stops
+  }
+
+  /** \brief Synchronously resolve host and port
+   *
+   * If an address selector predicate is specified, then each resolved IP address
+   * is checked against the predicate.
+   *
+   * Available address selector predicates:
+   *
+   * - resolver::AnyAddress()
+   * - resolver::Ipv4Address()
+   * - resolver::Ipv6Address()
+   */
+  static typename Protocol::endpoint
+  syncResolve(const std::string& host, const std::string& port,
+              const nfd::resolver::AddressSelector& addressSelector = nfd::resolver::AnyAddress())
+  {
+    Resolver resolver(SuccessCallback(), ErrorCallback(), addressSelector);
+
+    typename resolver::query query(host, port,
+                                   resolver::query::all_matching);
+
+    typename resolver::iterator remoteEndpoint = resolver.m_resolver.resolve(query);
+    typename resolver::iterator end;
+    for (; remoteEndpoint != end; ++remoteEndpoint)
+      {
+        if (addressSelector(typename Protocol::endpoint(*remoteEndpoint).address()))
+          return *remoteEndpoint;
+      }
+    throw Error("No endpoint matching the specified address selector found");
+  }
+
+private:
+  Resolver(const SuccessCallback& onSuccess,
+           const ErrorCallback& onError,
+           const nfd::resolver::AddressSelector& addressSelector)
+    : m_resolver(getGlobalIoService())
+    , m_addressSelector(addressSelector)
+    , m_onSuccess(onSuccess)
+    , m_onError(onError)
+  {
+  }
+
+  void
+  asyncResolve(const std::string& host, const std::string& port,
+               const time::Duration& timeout,
+               const shared_ptr<Resolver>& self)
+  {
+    typename resolver::query query(host, port,
+                                   resolver::query::all_matching);
+
+    m_resolver.async_resolve(query,
+                             bind(&Resolver::onResolveSuccess, this, _1, _2, self));
+
+    m_resolveTimeout = scheduler::schedule(timeout,
+                                           bind(&Resolver::onResolveError, this,
+                                                "Timeout", self));
+  }
+
+  void
+  onResolveSuccess(const boost::system::error_code& error,
+                   typename resolver::iterator remoteEndpoint,
+                   const shared_ptr<Resolver>& self)
+  {
+    scheduler::cancel(m_resolveTimeout);
+
+    if (error)
+      {
+        if (error == boost::system::errc::operation_canceled)
+          return;
+
+        return m_onError("Remote endpoint hostname or port cannot be resolved: " +
+                         error.category().message(error.value()));
+      }
+
+    typename resolver::iterator end;
+    for (; remoteEndpoint != end; ++remoteEndpoint)
+      {
+        if (m_addressSelector(typename Protocol::endpoint(*remoteEndpoint).address()))
+          return m_onSuccess(*remoteEndpoint);
+      }
+
+    m_onError("No endpoint matching the specified address selector found");
+  }
+
+  void
+  onResolveError(const std::string& errorInfo,
+                 const shared_ptr<Resolver>& self)
+  {
+    m_resolver.cancel();
+    m_onError(errorInfo);
+  }
+
+private:
+  resolver m_resolver;
+  EventId m_resolveTimeout;
+
+  nfd::resolver::AddressSelector m_addressSelector;
+  SuccessCallback m_onSuccess;
+  ErrorCallback m_onError;
+};
+
+typedef Resolver<boost::asio::ip::tcp> TcpResolver;
+typedef Resolver<boost::asio::ip::udp> UdpResolver;
+
+} // namespace nfd
+
+#endif // NFD_CORE_RESOLVER_H
diff --git a/tests/core/resolver.cpp b/tests/core/resolver.cpp
new file mode 100644
index 0000000..4d7460f
--- /dev/null
+++ b/tests/core/resolver.cpp
@@ -0,0 +1,229 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "core/resolver.hpp"
+#include "core/logger.hpp"
+#include <boost/test/unit_test.hpp>
+
+#include "tests/test-common.hpp"
+
+namespace nfd {
+namespace tests {
+
+NFD_LOG_INIT("tests.CoreResolver");
+
+using boost::asio::ip::address_v4;
+using boost::asio::ip::address_v6;
+using boost::asio::ip::tcp;
+using boost::asio::ip::udp;
+
+BOOST_FIXTURE_TEST_SUITE(CoreResolver, BaseFixture)
+
+template<class Protocol>
+class ResolverFixture : protected BaseFixture
+{
+public:
+  ResolverFixture()
+    : m_nFailures(0)
+    , m_nSuccesses(0)
+  {
+  }
+
+  void
+  onSuccess(const typename Protocol::endpoint& resolvedEndpoint,
+            const typename Protocol::endpoint& expectedEndpoint,
+            bool isValid, bool wantCheckAddress = false)
+  {
+    NFD_LOG_DEBUG("Resolved to: " << resolvedEndpoint);
+    ++m_nSuccesses;
+
+    if (!isValid)
+      {
+        BOOST_FAIL("Resolved to " + boost::lexical_cast<std::string>(resolvedEndpoint)
+                   + ", but it should have failed");
+      }
+
+    BOOST_CHECK_EQUAL(resolvedEndpoint.port(), expectedEndpoint.port());
+
+    BOOST_CHECK_EQUAL(resolvedEndpoint.address().is_v4(), expectedEndpoint.address().is_v4());
+
+    // checking address is not deterministic and should be enabled only
+    // if only one IP address will be returned by resolution
+    if (wantCheckAddress)
+      {
+        BOOST_CHECK_EQUAL(resolvedEndpoint.address(), expectedEndpoint.address());
+      }
+  }
+
+  void
+  onFailure(bool isValid)
+  {
+    ++m_nFailures;
+
+    if (!isValid)
+      BOOST_FAIL("Resolution should not have failed");
+
+    BOOST_CHECK_MESSAGE(true, "Resolution failed as expected");
+  }
+
+
+  uint32_t m_nFailures;
+  uint32_t m_nSuccesses;
+};
+
+BOOST_FIXTURE_TEST_CASE(Tcp, ResolverFixture<tcp>)
+{
+  TcpResolver::asyncResolve("www.named-data.net", "6363",
+                            bind(&ResolverFixture<tcp>::onSuccess, this, _1,
+                                 tcp::endpoint(address_v4(), 6363), true, false),
+                            bind(&ResolverFixture<tcp>::onFailure, this, false));
+
+  TcpResolver::asyncResolve("www.named-data.net", "notport",
+                            bind(&ResolverFixture<tcp>::onSuccess, this, _1,
+                                 tcp::endpoint(address_v4(), 0), false, false),
+                            bind(&ResolverFixture<tcp>::onFailure, this, true)); // should fail
+
+
+  TcpResolver::asyncResolve("nothost.nothost.nothost.arpa", "6363",
+                            bind(&ResolverFixture<tcp>::onSuccess, this, _1,
+                                 tcp::endpoint(address_v4(), 6363), false, false),
+                            bind(&ResolverFixture<tcp>::onFailure, this, true)); // should fail
+
+  TcpResolver::asyncResolve("www.google.com", "80",
+                            bind(&ResolverFixture<tcp>::onSuccess, this, _1,
+                                 tcp::endpoint(address_v4(), 80), true, false),
+                            bind(&ResolverFixture<tcp>::onFailure, this, false),
+                            resolver::Ipv4Address()); // request IPv4 address
+
+  TcpResolver::asyncResolve("www.google.com", "80",
+                            bind(&ResolverFixture<tcp>::onSuccess, this, _1,
+                                 tcp::endpoint(address_v6(), 80), true, false),
+                            bind(&ResolverFixture<tcp>::onFailure, this, false),
+                            resolver::Ipv6Address()); // request IPv6 address
+
+  TcpResolver::asyncResolve("ipv6.google.com", "80", // only IPv6 address should be available
+                            bind(&ResolverFixture<tcp>::onSuccess, this, _1,
+                                 tcp::endpoint(address_v6(), 80), true, false),
+                            bind(&ResolverFixture<tcp>::onFailure, this, false));
+
+  TcpResolver::asyncResolve("ipv6.google.com", "80", // only IPv6 address should be available
+                            bind(&ResolverFixture<tcp>::onSuccess, this, _1,
+                                 tcp::endpoint(address_v6(), 80), true, false),
+                            bind(&ResolverFixture<tcp>::onFailure, this, false),
+                            resolver::Ipv6Address());
+
+  TcpResolver::asyncResolve("ipv6.google.com", "80", // only IPv6 address should be available
+                            bind(&ResolverFixture<tcp>::onSuccess, this, _1,
+                                 tcp::endpoint(address_v6(), 80), false, false),
+                            bind(&ResolverFixture<tcp>::onFailure, this, true), // should fail
+                            resolver::Ipv4Address());
+
+  TcpResolver::asyncResolve("192.0.2.1", "80",
+                            bind(&ResolverFixture<tcp>::onSuccess, this, _1,
+                                 tcp::endpoint(address_v4::from_string("192.0.2.1"), 80), true, true),
+                            bind(&ResolverFixture<tcp>::onFailure, this, false));
+
+  TcpResolver::asyncResolve("2001:db8:3f9:0:3025:ccc5:eeeb:86d3", "80",
+                            bind(&ResolverFixture<tcp>::onSuccess, this, _1,
+                                 tcp::endpoint(address_v6::
+                                               from_string("2001:db8:3f9:0:3025:ccc5:eeeb:86d3"),
+                                               80), true, true),
+                            bind(&ResolverFixture<tcp>::onFailure, this, false));
+
+  g_io.run();
+
+  BOOST_CHECK_EQUAL(m_nFailures, 3);
+  BOOST_CHECK_EQUAL(m_nSuccesses, 7);
+}
+
+BOOST_AUTO_TEST_CASE(SyncTcp)
+{
+  tcp::endpoint endpoint;
+  BOOST_CHECK_NO_THROW(endpoint = TcpResolver::syncResolve("www.named-data.net", "6363"));
+  NFD_LOG_DEBUG("Resolved to: " << endpoint);
+  BOOST_CHECK_EQUAL(endpoint.address().is_v4(), true);
+  BOOST_CHECK_EQUAL(endpoint.port(), 6363);
+}
+
+BOOST_FIXTURE_TEST_CASE(Udp, ResolverFixture<udp>)
+{
+  UdpResolver::asyncResolve("www.named-data.net", "6363",
+                            bind(&ResolverFixture<udp>::onSuccess, this, _1,
+                                 udp::endpoint(address_v4(), 6363), true, false),
+                            bind(&ResolverFixture<udp>::onFailure, this, false));
+
+  UdpResolver::asyncResolve("www.named-data.net", "notport",
+                            bind(&ResolverFixture<udp>::onSuccess, this, _1,
+                                 udp::endpoint(address_v4(), 0), false, false),
+                            bind(&ResolverFixture<udp>::onFailure, this, true)); // should fail
+
+
+  UdpResolver::asyncResolve("nothost.nothost.nothost.arpa", "6363",
+                            bind(&ResolverFixture<udp>::onSuccess, this, _1,
+                                 udp::endpoint(address_v4(), 6363), false, false),
+                            bind(&ResolverFixture<udp>::onFailure, this, true)); // should fail
+
+  UdpResolver::asyncResolve("www.google.com", "80",
+                            bind(&ResolverFixture<udp>::onSuccess, this, _1,
+                                 udp::endpoint(address_v4(), 80), true, false),
+                            bind(&ResolverFixture<udp>::onFailure, this, false),
+                            resolver::Ipv4Address()); // request IPv4 address
+
+  UdpResolver::asyncResolve("www.google.com", "80",
+                            bind(&ResolverFixture<udp>::onSuccess, this, _1,
+                                 udp::endpoint(address_v6(), 80), true, false),
+                            bind(&ResolverFixture<udp>::onFailure, this, false),
+                            resolver::Ipv6Address()); // request IPv6 address
+
+  UdpResolver::asyncResolve("ipv6.google.com", "80", // only IPv6 address should be available
+                            bind(&ResolverFixture<udp>::onSuccess, this, _1,
+                                 udp::endpoint(address_v6(), 80), true, false),
+                            bind(&ResolverFixture<udp>::onFailure, this, false));
+
+  UdpResolver::asyncResolve("ipv6.google.com", "80", // only IPv6 address should be available
+                            bind(&ResolverFixture<udp>::onSuccess, this, _1,
+                                 udp::endpoint(address_v6(), 80), true, false),
+                            bind(&ResolverFixture<udp>::onFailure, this, false),
+                            resolver::Ipv6Address());
+
+  UdpResolver::asyncResolve("ipv6.google.com", "80", // only IPv6 address should be available
+                            bind(&ResolverFixture<udp>::onSuccess, this, _1,
+                                 udp::endpoint(address_v6(), 80), false, false),
+                            bind(&ResolverFixture<udp>::onFailure, this, true), // should fail
+                            resolver::Ipv4Address());
+
+  UdpResolver::asyncResolve("192.0.2.1", "80",
+                            bind(&ResolverFixture<udp>::onSuccess, this, _1,
+                                 udp::endpoint(address_v4::from_string("192.0.2.1"), 80), true, true),
+                            bind(&ResolverFixture<udp>::onFailure, this, false));
+
+  UdpResolver::asyncResolve("2001:db8:3f9:0:3025:ccc5:eeeb:86d3", "80",
+                            bind(&ResolverFixture<udp>::onSuccess, this, _1,
+                                 udp::endpoint(address_v6::
+                                               from_string("2001:db8:3f9:0:3025:ccc5:eeeb:86d3"),
+                                               80), true, true),
+                            bind(&ResolverFixture<udp>::onFailure, this, false));
+
+  g_io.run();
+
+  BOOST_CHECK_EQUAL(m_nFailures, 3);
+  BOOST_CHECK_EQUAL(m_nSuccesses, 7);
+}
+
+BOOST_AUTO_TEST_CASE(SyncUdp)
+{
+  udp::endpoint endpoint;
+  BOOST_CHECK_NO_THROW(endpoint = UdpResolver::syncResolve("www.named-data.net", "6363"));
+  NFD_LOG_DEBUG("Resolved to: " << endpoint);
+  BOOST_CHECK_EQUAL(endpoint.address().is_v4(), true);
+  BOOST_CHECK_EQUAL(endpoint.port(), 6363);
+}
+
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace nfd
