Ingen beskrivning
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.

Socket.cpp 1.2KB

1234567891011121314151617181920212223242526272829303132333435
  1. #include "os/c-api/il2cpp-config-platforms.h"
  2. #include "os/c-api/Socket-c-api.h"
  3. #include "os/c-api/Allocator.h"
  4. #include "os/Socket.h"
  5. #include "utils/Memory.h"
  6. #include <string>
  7. #include <vector>
  8. UnityPalWaitStatus UnityPalGetHostByName(const char* host, char** name, int32_t* family, char*** aliases, void*** address_list, int32_t* address_size)
  9. {
  10. std::string palName;
  11. int32_t palFamily;
  12. std::vector<std::string> palAliases;
  13. std::vector<void*> palAddressList;
  14. int32_t palAddressSize;
  15. il2cpp::os::WaitStatus result = il2cpp::os::Socket::GetHostByName(host, palName, palFamily, palAliases, palAddressList, palAddressSize);
  16. if (name != NULL)
  17. *name = Allocator::CopyToAllocatedStringBuffer(palName.c_str());
  18. if (family != NULL)
  19. *family = palFamily;
  20. Allocator::CopyStringVectorToNullTerminatedArray(palAliases, (void***)aliases);
  21. Allocator::CopyDataVectorToNullTerminatedArray(palAddressList, address_list, palAddressSize);
  22. if (address_size != NULL)
  23. *address_size = palAddressSize;
  24. for (size_t i = 0; i < palAddressList.size(); ++i)
  25. il2cpp::utils::Memory::Free(palAddressList[i]);
  26. return result;
  27. }