Skip to content

Instantly share code, notes, and snippets.

View scaryghost's full-sized avatar

Eric Tsai scaryghost

View GitHub Profile
@scaryghost
scaryghost / dnssd.cpp
Last active February 23, 2020 15:27
How to do a SRV or TXT record lookup in C/C++ on Linux.
/**
* compile: g++ -std=c++0x -o dnssd dnssd.cpp -lresolv
* Your g++ compiler must have lambda support
*
* Code based on examples from:
* http://www.cs.columbia.edu/~zwb/project/dotslash/dots_apache/dnsc.c
* http://people.samba.org/bzr/jerry/slag/unix/query-srv.c
*/
#include <arpa/nameser.h>
#include <functional>