I am currently working on an application which uses uPNP to open ports for P2P communication. I am using DI quite heavily, and would like to be able to inject the uPNP searcher through that, rather than going through the global. Because I need to perform operations based primarily on the capabilities of the network adapter, I am currently manually polling with NatUtility.Search(gatewayIp), using the gateway I've identified for the interface I'm targeting.
In addition, having a public API that does not have global state makes it much easier to test around, as well as being easier to write code with thread-safety.
Of course, I could also just be missing something that is already present that does exactly this. 😄
I am currently working on an application which uses uPNP to open ports for P2P communication. I am using DI quite heavily, and would like to be able to inject the uPNP searcher through that, rather than going through the global. Because I need to perform operations based primarily on the capabilities of the network adapter, I am currently manually polling with
NatUtility.Search(gatewayIp)
, using the gateway I've identified for the interface I'm targeting.In addition, having a public API that does not have global state makes it much easier to test around, as well as being easier to write code with thread-safety.
Of course, I could also just be missing something that is already present that does exactly this. 😄