Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Smugrik
Posts: 185
Registered: ‎04-05-2011
My Device: PlayBook
Accepted Solution

Is there a library for Bonjour mdns connectivity?

Hi there,

 

For one of my projects, I need to have Bonjour connectivity over UDP, I already managed to set up a UDP socket connection between the PlayBook and my computer, but I'm not sure how to go with Bonjour.

Do you know of a library already available for the PlayBook or QNX?

 

Thanks!

Julien
Web: smugrik.org Follow: @Smugrik
PlayBook apps:
OSCream
kiPass
Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1154, PlayBook (16GB)-2.1.0.1917

Re: Is there a library for Bonjour mdns connectivity?

Not that I can tell.
---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
trollixx
Posts: 60
Registered: ‎04-18-2012
My Device: BB10 Dev Alpha C

Re: Is there a library for Bonjour mdns connectivity?

Apple's mDNSResponder is open source and support POSIX OSes, so maybe it can be ported to QNX with minimal effort. See http://opensource.apple.com/source/mDNSResponder/
--
Oleg Shparber
Please use plain text.
Developer
Smugrik
Posts: 185
Registered: ‎04-05-2011
My Device: PlayBook

Re: Is there a library for Bonjour mdns connectivity?

I tried that, but I'm not so familiar with C, or Makefiles or Posix. So I wasn't successful yet in compiling the library for PlayBook, and my dev environment is Windows,which seems to be problematic with the GNU make toolchain (gives me an error that uname is not a known command...). I was also looking at a possible QNX port but didn'tfind much about it, someone on the Internet released a 'patch' for Bonjour on QNX a few years ago on a mailing list, but I couldn't figure out what it was good for.

I'm not giving up though...

Julien
Web: smugrik.org Follow: @Smugrik
PlayBook apps:
OSCream
kiPass
Please use plain text.
Developer
HorizonXP
Posts: 133
Registered: ‎03-28-2011
My Device: BlackBerry 9900 & PlayBook

Re: Is there a library for Bonjour mdns connectivity?

If I compile this for you, will you love me... FOREVER?


Founder of Pulsecode Inc. and taab
Authomator - Two-factor authentication codes on BlackBerry 10 - http://www.xitijpatel.com/ - Follow @xitijpatel
Is there a helpful or useful post in this thread? Click the thumbs up on it so that other people can find it more easily!
Please use plain text.
Developer
Smugrik
Posts: 185
Registered: ‎04-05-2011
My Device: PlayBook

Re: Is there a library for Bonjour mdns connectivity?

:-) not to fork the thread, but I'd give PySide a higher rank of coolness than Bonjour ;-)

Julien
Web: smugrik.org Follow: @Smugrik
PlayBook apps:
OSCream
kiPass
Please use plain text.
Developer
HorizonXP
Posts: 133
Registered: ‎03-28-2011
My Device: BlackBerry 9900 & PlayBook

Re: Is there a library for Bonjour mdns connectivity?

[ Edited ]

LOL, ok, well I'll get back to PySide then. :-P

 

But I did take a look at it for you, and started doing some work.

 

http://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-333.10.tar.gz

 

Grab that tarball and extract it. If you look in the folder it extracts, you'll see a mDNSPosix folder. If you look inside there, you'll see a Makefile. Adding these lines will get you started:

 

Lines 102-110

ifeq ($(os),qnx)
CC = ntoarmv7-gcc
CFLAGS_OS = -I/opt/bbndk-2.0.0/target/qnx6/usr/include
LD = ntoarmv7-gcc -shared
LINKOPTS = -lsocket -lnsl -lresolv
ifneq ($(DEBUG),1)
STRIP = ntoarmv7-strip
endif
else

 and add the following to line 172

endif

 

You'll need to set this up on a Ubuntu/Linux build environment, most likely. If you install build-essentials and bison from apt-get, that should get you what you need to start building. I was in the middle of figuring out the compiler options to have it find the headers, when I stopped to write this post.

 

EDIT: looked at this a bit more, your next hurdle is a lack of syslog.h. It's not shipped with the NDK. According to this post:

http://supportforums.blackberry.com/t5/Native-Development/syslog/td-p/1424045

 

you're going to have to implement your own, or remove it from the files somehow. To be honest, I don't think it would be difficult to implement yourself, but just to get going for now, I'd remove it and any functions that reference it, for now.

 

Give me a like. ;-)


Founder of Pulsecode Inc. and taab
Authomator - Two-factor authentication codes on BlackBerry 10 - http://www.xitijpatel.com/ - Follow @xitijpatel
Is there a helpful or useful post in this thread? Click the thumbs up on it so that other people can find it more easily!
Please use plain text.
Developer
Smugrik
Posts: 185
Registered: ‎04-05-2011
My Device: PlayBook

Re: Is there a library for Bonjour mdns connectivity?

Thanks a lot for your indications, it really helped!!

 

I set up a dev env on Ubuntu 12.04, just a plain ubuntu install with no config, and simply installing BB ndk 2.0 was enough to be able to compile!!

 

I'm progressing on this slowly...

For now, I just removed all references to syslog, for now...

It seems I already have compiled the basic libraries and a few of the embedded exemples, next step will be to run a simple test on the PlayBook.

 

A few remarks:

-lnsl and -lresolv seem not to be available on QNX, I just removed the links and it seemed to work, there are also a few headers that need to be renamed or refactored... (<sys/fcntl.h> is in <fcntl.h> on qnx ...)

 

Hope I'll have this done by the end of the week.

 

 

Julien
Web: smugrik.org Follow: @Smugrik
PlayBook apps:
OSCream
kiPass
Please use plain text.
Developer
Smugrik
Posts: 185
Registered: ‎04-05-2011
My Device: PlayBook

Re: Is there a library for Bonjour mdns connectivity?

It seems I'm almost done with Bonjour on the PlayBook, tonight I just managed to compile through all the steps.

 

Now I just need to code a test app for the PlayBook to verify the compiled lib is actually working... hopefully it will be ok, but I'll leave that for tomorrow, it's late here, need a rest ;-)

 

And with a bit of luck, I'll have my app ready to deploy when I get the dev alpha in Paris next Tuesday :-P

Julien
Web: smugrik.org Follow: @Smugrik
PlayBook apps:
OSCream
kiPass
Please use plain text.
Developer
HorizonXP
Posts: 133
Registered: ‎03-28-2011
My Device: BlackBerry 9900 & PlayBook

Re: Is there a library for Bonjour mdns connectivity?

That's fantastic to hear! Really looking forward to what you'll come up with. 

 

Be sure to contribute your changes upstream back to Apple, so that we can all benefit from the work. :-)


Founder of Pulsecode Inc. and taab
Authomator - Two-factor authentication codes on BlackBerry 10 - http://www.xitijpatel.com/ - Follow @xitijpatel
Is there a helpful or useful post in this thread? Click the thumbs up on it so that other people can find it more easily!
Please use plain text.