Hi all, Since Emacs gained the capability to make asynchronous DNS lookups under GNU/Linux, I've been wishing for the same thing under OSX. Here is a little patch that I've hacked together, that I'd like some feedback on. In particular: 1. In Fmake_network_process, there's an XXX comment about deallocating my CFStringRef. I couldn't figure out from the documentation whether CFHostCreateWithName takes ownership of the string, or just copies it. 2. There is a callback function, host_client_callback, that writes error information into memory referred to by the process struct. There is a potential for a race condition here: what if the callback is called after the process has been deallocated? I've tried to avoid that by cancelling name resolution before deallocating the memory (see free_dns_request), but I suspect that's not enough. Is there a clever way to avoid that? 3. Unlike getaddrinfo_a, this CFHost thing doesn't resolve service names to port numbers. Therefore, I arrange to call getservbyname in Fmake_network_process, and insert the port number into a copy of the sockaddr struct in check_for_dns. I _think_ this should work for both IPv4 and IPv6, but I haven't tested IPv6. Is there a nicer way to do this? It took me a while to figure out the port number thing: before I added the port number, the process seemed to silently do nothing. That's because non-blocking connect would fail, and connect_network_socket would treat that as having to do a synchronous connect, which ended up not happening. I'm not sure if this is a bug or a feature. Any other comments are appreciated as well. I'll have sporadic Internet access during the coming week or so, will probably look at this again after that time. Regards, Magnus