+static void network_resolve_host_async( void *payload, u32 size )
+{
+ u32 *status = payload;
+ network_client.ip_resolved = *status;
+
+ char buf[256];
+ SteamAPI_SteamNetworkingIPAddr_ToString( &network_client.ip, buf, 256, 1 );
+ vg_info( "Resolved host address to: %s\n", buf );
+}
+
+static void network_resolve_host_thread( void *_ )
+{
+ vg_async_item *call = vg_async_alloc(8);
+ u32 *status = call->payload;
+ *status = 0;
+
+ if( (network_client.host_adress[0] >= '0') &&
+ (network_client.host_adress[0] <= '9') )
+ {
+ SteamAPI_SteamNetworkingIPAddr_ParseString(
+ &network_client.ip,
+ network_client.host_adress );
+ network_client.ip.m_port = atoi( network_client.host_port );
+ *status = 1;
+ goto end;
+ }
+
+ vg_info( "Resolving host.. %s (:%s)\n",
+ network_client.host_adress, network_client.host_port );
+
+ struct addrinfo hints;
+ struct addrinfo *result;
+
+ /* Obtain address(es) matching host/port. */
+
+ memset( &hints, 0, sizeof(hints) );
+ hints.ai_family = AF_INET6;
+ hints.ai_socktype = SOCK_DGRAM;
+ hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG;
+ hints.ai_protocol = 0;
+
+ int s = getaddrinfo( network_client.host_adress, network_client.host_port,
+ &hints, &result);
+ if( s != 0 )
+ {
+ vg_error( "getaddrinfo: %s\n", gai_strerror(s) );
+ goto end;
+ }
+
+ struct sockaddr_in6 *inaddr = (struct sockaddr_in6 *)result->ai_addr;
+ memcpy( network_client.ip.m_ipv6, &inaddr->sin6_addr, 16 );
+ freeaddrinfo( result );
+
+ *status = 1;
+
+end: vg_async_dispatch( call, network_resolve_host_async );
+}
+