3

I am trying to make an online game application, which communicates with another pc peer-to-peer over the Internet. Since both pc's are likely to be under NAT, and since I cannot afford an external server, I thought the only way is to use free STUN and TURN server, such as Numb.

However, after some research, I couldn't figure out how to use those servers to make a connection.

Is it really possible to use only those servers to do it? If it is, how would you do that? Or is there an easier way of doing that?

I can use either UDP or TCP for this.

eivour
  • 1,678
  • 12
  • 20

1 Answers1

1

Take a look at the Internet Gateway Device Protocol. Is is an extension to the UPNP protocol, is very easy to use, is supported by pretty much every router out there and there are some free libs implementing this protocol.

  • Thanks!! I've yet to try it out, but it looks like what I was looking for!! – eivour May 05 '14 at 15:54
  • @eivour You are welcome! If it really answer your question, please consider accepting the answer. Good coding! – Vinícius Gobbo A. de Oliveira May 06 '14 at 00:48
  • Well, I tried the type library, but it did not work for me... UPnPNATClass.StaticPortMappingCollection somehow returned null, and I could not add new port to it. I checked that UPnP option in the router is turned on, and that the windows allows network discovery, so I think UPnP is available. – eivour May 06 '14 at 14:26
  • @eivour Either you just found a bug in the library, or you missed some detail from the documentation. Which library are you using? Despite knowing what it is and when to use it, I've never used UPnP before, but I'll try to help you as much as I can. – Vinícius Gobbo A. de Oliveira May 07 '14 at 02:53
  • The type library is a COM library called "NATUPnP 1.0 Type Library", which seems to be preinstalled in my computer.(I looked at this: http://pietschsoft.com/post/2009/02/05/NET-Framework-Communicate-through-NAT-Router-via-UPnP) It seems really simple to use, but somehow I can't get it to work... I tried the example application in that site, but that didn't work either (with the same error). I use windows 7, 64bit, and I checked the services upnphost and SSDPSRV are both running. – eivour May 07 '14 at 15:24
  • 1
    Either your router is not fully compliant, or it needs a reboot: I've seen some routers (specially D-Link ones) in a need for a reboot or in a need of a disable/enable the UPNP feature in order to make it work properly. If the sample app does not work either, I belive this is not an issue with the API itself. – Vinícius Gobbo A. de Oliveira May 08 '14 at 01:56
  • Disabling UPnP on the router settings and enabling it back worked!! Now my UPnP works well. Thank you for your help!! – eivour May 09 '14 at 10:54