miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Include miniupnp in c++ (kick start for newbies)

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Compilation/Installation
View previous topic :: View next topic  
Author Message
Nocs



Joined: 07 Mar 2016
Posts: 3

PostPosted: Mon Mar 07, 2016 11:28 pm    Post subject: Include miniupnp in c++ (kick start for newbies) Reply with quote

Hello tuxfamily,

First of all great work !
Since i am a newbie in c++ and therefore learned much in a small period of time i am trying to create dynamically through my app a port forwarding so my app which has UDP and TCP connections can send and recieve finally messages via internet through a router at specific port.

On my searches around the net i droped on your miniupnp which as far as i read around seems well promising and you do well cause with windows libraries port forwarding seems like trying to open a wall with your bare fingers.

So to get strait to the point, i downloaded your latest minipnpc.tar and compiled the solution for MS VS and the upnpc-static.exe runs ok as first sight on my system but i would like to know how and what to import from your libraries and headers into my UDP and TCP application and get started using your miniupnp to make two things :
1. finally open a desired port on my router and close it whenever i like it or find the appropiate port on my router to communicate from and with via internet
2. send and recieve UDP or TCP messages into this port via internet

These are my basic kick starts to check this and congruts you but i dont know what to implement on my c++ app from your libraries and headers yet.

Could you kinldy point me according to my needs ?
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Tue Mar 08, 2016 12:15 pm    Post subject: Reply with quote

well if you compiled for MSVC you should have noticed it is producing a library.
See upnpc.c to see how to use the library.

Code:

devlist = upnpDiscover(2000, multicastif, minissdpdpath,
                                localport, ipv6, ttl, &error);

i = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));

UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
               eport, iport, iaddr, description,
               proto, 0, leaseDuration);


see documentation of each function in miniupnpc.h / upnpcommands.h
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Nocs



Joined: 07 Mar 2016
Posts: 3

PostPosted: Tue Mar 08, 2016 1:40 pm    Post subject: Reply with quote

Thank you for your response.
Yes it creates a lib file, i will use this lib in my project app
I dont use any headers on my app ? only the lib ?
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Tue Mar 08, 2016 3:51 pm    Post subject: Reply with quote

Quote:
see documentation of each function in miniupnpc.h / upnpcommands.h

You won't ask us make your work, will you ?
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Nocs



Joined: 07 Mar 2016
Posts: 3

PostPosted: Tue Mar 08, 2016 4:45 pm    Post subject: Reply with quote

As i said ita kickstart for newbies but i will try to implement it as your header says.

Thank you for your response
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Compilation/Installation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.