You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.
When searching for NAT devices (DiscoverDeviceAsync method) results can be out of order. That is, sometimes IPv6 device is returned instead of IPv4.
This happens because DiscoverDeviceAsync method always return the first element in devices found list. But the list order is unpredictable since you cannot know which device will respond first during discovery. So, GetExternalIPAddress fails on some Routers cause it is trying to get IPv6 Address that is not currently active on router's WAN interface. In this case, other methods like CreatePortMapAsync or DeletePortMapAsync do not work as well.
I solved this by extending NatDiscoverer class and creating a method that accepts another argument that acts as a filter. This new method filters the result by IP's AddressFamily. Therefore, I always retrieve the right device and no problems ocurrs when getting external IP address.
I think it would be easier if NatDevice class or UpnpNatDevice contained public fields that identify which type of device it is, like IP family, service type, and so on.
The text was updated successfully, but these errors were encountered:
When searching for NAT devices (
DiscoverDeviceAsync
method) results can be out of order. That is, sometimes IPv6 device is returned instead of IPv4.This happens because
DiscoverDeviceAsync
method always return the first element in devices found list. But the list order is unpredictable since you cannot know which device will respond first during discovery. So,GetExternalIPAddress
fails on some Routers cause it is trying to get IPv6 Address that is not currently active on router's WAN interface. In this case, other methods likeCreatePortMapAsync
orDeletePortMapAsync
do not work as well.I solved this by extending
NatDiscoverer
class and creating a method that accepts another argument that acts as a filter. This new method filters the result by IP's AddressFamily. Therefore, I always retrieve the right device and no problems ocurrs when getting external IP address.I think it would be easier if
NatDevice
class orUpnpNatDevice
contained public fields that identify which type of device it is, like IP family, service type, and so on.The text was updated successfully, but these errors were encountered: