]> git.meshlink.io Git - catta/blobdiff - avahi-sharp/HostNameResolver.cs
l10n: Updates to Spanish (Castilian) (es) translation
[catta] / avahi-sharp / HostNameResolver.cs
index 0922aa787c1339b34c9f1014fd1c3703b6413904..81305fd778efd9c35b4ee3bdc7591b2e802d8de8 100644 (file)
@@ -23,6 +23,7 @@ using System;
 using System.Collections;
 using System.Net;
 using System.Runtime.InteropServices;
+using System.Text;
 using Mono.Unix;
 
 namespace Avahi
@@ -51,7 +52,7 @@ namespace Avahi
         
         [DllImport ("avahi-client")]
         private static extern IntPtr avahi_host_name_resolver_new (IntPtr client, int iface, Protocol proto,
-                                                                   IntPtr hostname, Protocol aproto, LookupFlags flags,
+                                                                   byte[] hostname, Protocol aproto, LookupFlags flags,
                                                                    HostNameResolverCallback cb, IntPtr userdata);
 
         [DllImport ("avahi-client")]
@@ -125,14 +126,14 @@ namespace Avahi
                 (foundListeners.Count == 0 && timeoutListeners.Count == 0))
                 return;
 
-            IntPtr hostPtr = Utility.StringToPtr (hostname);
-
             lock (client) {
-                handle = avahi_host_name_resolver_new (client.Handle, iface, proto, hostPtr, aproto, flags,
+                handle = avahi_host_name_resolver_new (client.Handle, iface, proto,
+                                                       Utility.StringToBytes (hostname), aproto, flags,
                                                        cb, IntPtr.Zero);
+
+                if (handle == IntPtr.Zero)
+                    client.ThrowError ();
             }
-            
-            Utility.Free (hostPtr);
         }
 
         private void Stop (bool force)