Skip to content

Instantly share code, notes, and snippets.

View abhay-singh's full-sized avatar
🎯
Focusing

Abhay Singh Naurang abhay-singh

🎯
Focusing
View GitHub Profile
@abhay-singh
abhay-singh / bonjour.m
Created October 29, 2020 11:39 — forked from leuchtetgruen/bonjour.m
Bonjour Quickie in Objective-C - Service Announcement and discovery in just 6 lines of code.
// This is how you announce a service - saying i offer service _someservice._tcp. on port 4711
NSNetService *nets = [[NSNetService alloc] initWithDomain:@"local." type:@"_someservice._tcp." name:@"" port:4711];
[nets setDelegate:self];
[nets publish];
// And this is how you find a service
NSNetServiceBrowser *browser = [[NSNetServiceBrowser alloc] init];
[browser setDelegate:self];