/// <summary>
 /// <para>/ Parse back SteamNetworkPingLocation_t string.  Returns false if we couldn't understand</para>
 /// <para>/ the string.</para>
 /// </summary>
 public static bool ParsePingLocationString(string pszString, out SteamNetworkPingLocation_t result)
 {
     InteropHelp.TestIfAvailableClient();
     using (var pszString2 = new InteropHelp.UTF8StringHandle(pszString)) {
         return(NativeMethods.ISteamNetworkingUtils_ParsePingLocationString(CSteamAPIContext.GetSteamNetworkingUtils(), pszString2, out result));
     }
 }
        /// <summary>
        /// <para>/ Convert a ping location into a text format suitable for sending over the wire.</para>
        /// <para>/ The format is a compact and human readable.  However, it is subject to change</para>
        /// <para>/ so please do not parse it yourself.  Your buffer must be at least</para>
        /// <para>/ k_cchMaxSteamNetworkingPingLocationString bytes.</para>
        /// </summary>
        public static void ConvertPingLocationToString(ref SteamNetworkPingLocation_t location, out string pszBuf, int cchBufSize)
        {
            InteropHelp.TestIfAvailableClient();
            IntPtr pszBuf2 = Marshal.AllocHGlobal(cchBufSize);

            NativeMethods.ISteamNetworkingUtils_ConvertPingLocationToString(CSteamAPIContext.GetSteamNetworkingUtils(), ref location, pszBuf2, cchBufSize);
            pszBuf = InteropHelp.PtrToStringUTF8(pszBuf2);
            Marshal.FreeHGlobal(pszBuf2);
        }
 /// <summary>
 /// <para> "Ping location" functions</para>
 /// <para> We use the ping times to the valve relays deployed worldwide to</para>
 /// <para> generate a "marker" that describes the location of an Internet host.</para>
 /// <para> Given two such markers, we can estimate the network latency between</para>
 /// <para> two hosts, without sending any packets.  The estimate is based on the</para>
 /// <para> optimal route that is found through the Valve network.  If you are</para>
 /// <para> using the Valve network to carry the traffic, then this is precisely</para>
 /// <para> the ping you want.  If you are not, then the ping time will probably</para>
 /// <para> still be a reasonable estimate.</para>
 /// <para> This is extremely useful to select peers for matchmaking!</para>
 /// <para> The markers can also be converted to a string, so they can be transmitted.</para>
 /// <para> We have a separate library you can use on your app's matchmaking/coordinating</para>
 /// <para> server to manipulate these objects.  (See steamdatagram_gamecoordinator.h)</para>
 /// <para>/ Return location info for the current host.  Returns the approximate</para>
 /// <para>/ age of the data, in seconds, or -1 if no data is available.</para>
 /// <para>/</para>
 /// <para>/ It takes a few seconds to initialize access to the relay network.  If</para>
 /// <para>/ you call this very soon after calling InitRelayNetworkAccess,</para>
 /// <para>/ the data may not be available yet.</para>
 /// <para>/</para>
 /// <para>/ This always return the most up-to-date information we have available</para>
 /// <para>/ right now, even if we are in the middle of re-calculating ping times.</para>
 /// </summary>
 public static float GetLocalPingLocation(out SteamNetworkPingLocation_t result)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamNetworkingUtils_GetLocalPingLocation(CSteamAPIContext.GetSteamNetworkingUtils(), out result));
 }
 /// <summary>
 /// <para>/ Same as EstimatePingTime, but assumes that one location is the local host.</para>
 /// <para>/ This is a bit faster, especially if you need to calculate a bunch of</para>
 /// <para>/ these in a loop to find the fastest one.</para>
 /// <para>/</para>
 /// <para>/ In rare cases this might return a slightly different estimate than combining</para>
 /// <para>/ GetLocalPingLocation with EstimatePingTimeBetweenTwoLocations.  That's because</para>
 /// <para>/ this function uses a slightly more complete set of information about what</para>
 /// <para>/ route would be taken.</para>
 /// </summary>
 public static int EstimatePingTimeFromLocalHost(ref SteamNetworkPingLocation_t remoteLocation)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamNetworkingUtils_EstimatePingTimeFromLocalHost(CSteamAPIContext.GetSteamNetworkingUtils(), ref remoteLocation));
 }
 /// <summary>
 /// <para>/ Estimate the round-trip latency between two arbitrary locations, in</para>
 /// <para>/ milliseconds.  This is a conservative estimate, based on routing through</para>
 /// <para>/ the relay network.  For most basic relayed connections, this ping time</para>
 /// <para>/ will be pretty accurate, since it will be based on the route likely to</para>
 /// <para>/ be actually used.</para>
 /// <para>/</para>
 /// <para>/ If a direct IP route is used (perhaps via NAT traversal), then the route</para>
 /// <para>/ will be different, and the ping time might be better.  Or it might actually</para>
 /// <para>/ be a bit worse!  Standard IP routing is frequently suboptimal!</para>
 /// <para>/</para>
 /// <para>/ But even in this case, the estimate obtained using this method is a</para>
 /// <para>/ reasonable upper bound on the ping time.  (Also it has the advantage</para>
 /// <para>/ of returning immediately and not sending any packets.)</para>
 /// <para>/</para>
 /// <para>/ In a few cases we might not able to estimate the route.  In this case</para>
 /// <para>/ a negative value is returned.  k_nSteamNetworkingPing_Failed means</para>
 /// <para>/ the reason was because of some networking difficulty.  (Failure to</para>
 /// <para>/ ping, etc)  k_nSteamNetworkingPing_Unknown is returned if we cannot</para>
 /// <para>/ currently answer the question for some other reason.</para>
 /// <para>/</para>
 /// <para>/ Do you need to be able to do this from a backend/matchmaking server?</para>
 /// <para>/ You are looking for the "ticketgen" library.</para>
 /// </summary>
 public static int EstimatePingTimeBetweenTwoLocations(ref SteamNetworkPingLocation_t location1, ref SteamNetworkPingLocation_t location2)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamNetworkingUtils_EstimatePingTimeBetweenTwoLocations(CSteamAPIContext.GetSteamNetworkingUtils(), ref location1, ref location2));
 }