Quote Originally Posted by dilettante View Post
What about https://www.ipify.org/ who offer an API?
As the name suggests, it was primarily put together as a NAT port forwarding tester. The Public IP was an after thought that took about 2 lines of code. I realize that online port scanners could do the testing, but I needed to do this in code and I wanted to keep it small. It would have been nice to use the UPnP code that you posted, but that didn't work out.

As an aside, I found this bit of code to get the external IP, but it looks like it is for some other kind of Basic and I could not get it to work.
Code:
Imports NATUPNPLib
Public Class RouterInfo
Dim cRouter As NATUPNPLib.UPnPNAT

Public Sub New()
     cRouter = New NATUPNPLib.UPnPNAT
End Sub

Public Function GetExternalIP() As String
     Dim lMapper = cRouter.StaticPortMappingCollection
     Dim lMappedPort As NATUPNPLib.IStaticPortMapping
     Dim lExtIP As String
     If Not lMapper Is Nothing Then
          For Each lMappedPort In lMapper
               lExtIP = lMappedPort.ExternalIPAddress().ToString
               Exit For
          Next
          GetExternalIP = lExtIP
     Else
          GetExternalIP = "<Unable to resolve external IP>"
     End If
End Function
J.A. Coutts