1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 20:25:47 +00:00

Create inet_htons

This commit is contained in:
twinaphex 2016-05-03 04:35:51 +02:00
parent 35b7d0423f
commit f60676f43e
4 changed files with 14 additions and 4 deletions

View File

@ -250,7 +250,7 @@ bool retro_load_game(const struct retro_game_info *info)
memset((char *) &si_other, 0, sizeof(si_other));
si_other.sin_family = AF_INET;
si_other.sin_port = htons(port);
si_other.sin_port = inet_htons(port);
#if defined(_WIN32) || defined(HAVE_SOCKET_LEGACY)
si_other.sin_addr.S_un.S_addr = inet_addr(server);
#else

View File

@ -211,6 +211,8 @@ struct addrinfo
#endif
uint16_t inet_htons(uint16_t hostshort);
int getaddrinfo_retro(const char *node, const char *service,
struct addrinfo *hints, struct addrinfo **res);

View File

@ -173,7 +173,7 @@ int getaddrinfo_retro(const char *node, const char *service,
info->ai_addrlen = sizeof(*in_addr);
in_addr->sin_family = AF_INET;
in_addr->sin_port = htons(strtoul(service, NULL, 0));
in_addr->sin_port = inet_htons(strtoul(service, NULL, 0));
if (!node && (hints->ai_flags & AI_PASSIVE))
in_addr->sin_addr.s_addr = INADDR_ANY;
@ -317,3 +317,12 @@ void network_deinit(void)
net_deinit();
#endif
}
uint16_t inet_htons(uint16_t hostshort)
{
#ifdef VITA
return sceNetHtons(hostshort);
#else
return htons(hostshort);
#endif
}

View File

@ -58,13 +58,12 @@ void logger_init (void)
SOCKET_TYPE_DATAGRAM,
SOCKET_PROTOCOL_NONE);
target.sin_port = inet_htons(port);
#ifdef VITA
target.sin_family = PSP2_NET_AF_INET;
target.sin_port = sceNetHtons(port);
target.sin_addr = inet_aton(server);
#else
target.sin_family = AF_INET;
target.sin_port = htons(port);
#ifdef GEKKO
target.sin_len = 8;
#endif