No announcement yet.

UPnP services...

  • Filter
  • Time
  • Show
Clear All
new posts

  • José Roca
    The structure must be declared as

    TYPE UpnpController
      control_url     AS ASCIIZ PTR
      service_type    AS ASCIIZ PTR
    Original C declaration:

    /* UpnpController structure definition */
    struct LIBNAT_API UpnpController
      char * control_url;
      char * service_type;
    and the ip_len parameter of the LNat_Upnp_Get_Public_Ip function must be BYVAL.

    Leave a comment:

  • Brian Chirgwin
    Are you writing your own chat program? If not, what chat program are you using?

    If your using one of the major chat programs, you can configure your router to allow specific ports through. There are many sites that list the port numbers. google "TCP PORTs appname"

    MSN Messenger info can be found here.

    You may also have to allow the application through any firewalls installed.

    Leave a comment:

  • David Marcovich
    Thanks Brian,

    I think you are right.
    I need know the external IP of a routered PC in order to allow IP to IP chat.
    I don't know how MSN works, but I need some like this...

    Any ideas are welcomed.

    Thanks in advance,
    David de Argentina

    Leave a comment:

  • Brian Chirgwin
    I haven't executed the code as I have UPnP turned off, but looking I see the following.

    local ip as Asciiz * 15 should be local ip as ASciiz * 16 ' Need extra byte for ending chr$(0)
    I did not double check the declares. AsciiZ might need to be string.

    Most home routers have an option to have UPnP turned off and businesses definately do. At least anyone who is worried about security. You don't want someone (hacker) changing your router to allow complete access into your LAN.

    Leave a comment:

  • David Marcovich
    started a topic UPnP services...

    UPnP services...

    Hi All,

    I had found some stuff about UPnP and NAT.
    Source code is available at:

    My first aproach is this:

    #compile exe
    type UpnpController
      control_url 	as string * 15
      service_type	as string * 512 
    end type
    Declare Function LNat_Upnp_Discover  cdecl Lib "libnat.dll" Alias "LNat_Upnp_Discover" ( upnp as UpnpController ) as long
    Declare Function LNat_Upnp_Get_Public_Ip cdecl Lib "libnat.dll" Alias "LNat_Upnp_Get_Public_Ip" ( upnp as UpnpController, IP as asciiz, ip_len as long ) as long
    Declare Function LNat_Upnp_Controller_Free  cdecl Lib "libnat.dll" Alias "LNat_Upnp_Controller_Free" ( upnp as UpnpController ) as long
    function pbmain()
    local ip as asciiz * 15, result as long, ip_len as long
    local upnp as UpnpController
    ip = ""
    ip_len = Sizeof(ip)
    result = LNat_Upnp_Discover(upnp)
    if result <> 0 then msgbox "Failed at Router comunication" : exit function
    result = LNat_Upnp_Get_Public_Ip (upnp, ip, ip_len)
    if result <> 0 then msgbox "Router is not UPnP compatible" : exit function
    result = LNat_Upnp_Controller_Free(upnp)
    MsgBox ip
    end function
    But doesn't work.
    Any ideas ?

    Thanks in advance,
    David Marcovich