Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

host_name.ipp 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // ip/impl/host_name.ipp
  3. // ~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef ASIO_IP_IMPL_HOST_NAME_IPP
  11. #define ASIO_IP_IMPL_HOST_NAME_IPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/config.hpp"
  16. #include "asio/detail/socket_ops.hpp"
  17. #include "asio/detail/throw_error.hpp"
  18. #include "asio/detail/winsock_init.hpp"
  19. #include "asio/ip/host_name.hpp"
  20. #include "asio/detail/push_options.hpp"
  21. namespace asio {
  22. namespace ip {
  23. std::string host_name()
  24. {
  25. char name[1024];
  26. asio::error_code ec;
  27. if (asio::detail::socket_ops::gethostname(name, sizeof(name), ec) != 0)
  28. {
  29. asio::detail::throw_error(ec);
  30. return std::string();
  31. }
  32. return std::string(name);
  33. }
  34. std::string host_name(asio::error_code& ec)
  35. {
  36. char name[1024];
  37. if (asio::detail::socket_ops::gethostname(name, sizeof(name), ec) != 0)
  38. return std::string();
  39. return std::string(name);
  40. }
  41. } // namespace ip
  42. } // namespace asio
  43. #include "asio/detail/pop_options.hpp"
  44. #endif // ASIO_IP_IMPL_HOST_NAME_IPP