libupnp be used by multiple processes

  • jcfcc

    jcfcc - 2014-03-06

    Hi all,

    May I ask what would happen if the libupnp library was used by more than 1 processes on a Linux PC?
    Would I expected to see more than 1 root-devices on the connected LAN? Or, just 1 root-device with several sub-devices? Is it configurable? (1 root-device)

    Thanks in advance for your helps!

  • Tieske

    Tieske - 2014-03-06

    If compiled statically, it is completely independent. When using it as a shared library, then I don't know... I don't know Linux internals well enough, but still would expect it to work independently.

    I would not expect devices to mix. It either works (indepedent, so you'll see multiple root devices) or otherwise it would crash I expect, due to a lot of multithreading.

  • Marcelo Roberto Jimenez


    Whether you compile it as a static or a dynamic library, it makes no difference. There are (or at least, there should not be) no global variables, so the library is reentrant.

    It is unlikely that you want more than one device running at the same computer. By default, each independent device will try to bind to all interfaces in the same port. Only the first one will succeed, all the others will fail. It is possible to make them bind to different interfaces, so that they would run on different networks, but that is a very unconventional scenario. Binding on different ports would probably not be a good idea, since the other upnp control points would not be able to find anything, meaning an even more unconventional setup.

    The idea of dynamically creating sub-devices is not a bad one, but is certainly not implemented in libupnp. Also I have never heard of an implementation of it. It would require some kind of registration with the master device, or the creation of it for the first device. It could certainly be done on top of the current code.

    The constraint is that any extra layers should be optional, since upnp is supposed to run on embedded hardware with some strict memory limitations. For most devices it makes no sense to support "multi-device" mode.


  • jcfcc

    jcfcc - 2014-03-07

    Thanks much for all your feedback! Very appreciate the kind help!
    :-) cc


Log in to post a comment.