I've been trying to create a socket chat/file transfer application for several weeks now. I've spent hours searching on the internet for a piece of code on UDP hole punching to work with, but I haven't found anything that works or is simple enough for me to use.
I'm trying to get two clients behind routers (NATs) to connect to each other. I've managed to set up a server that shares the two clients IPs and ports, but I haven't managed to actually initiate a connection. Is there any source code anywhere that I can use?
I've found several STUN/ICE/TURN libraries like JStun, but there's no documentation on how to use them. Do I need a STUN server to start the connection? Can I use a public one like numb.viagenie.ca or http://www.stunserver.org/ ?
Any answers would be greatly appreciated. Thanks!
EDIT: I've had a bit more poking around, and I've discovered that STUN is fairly easy to make even through PHP. I've set up my own PHP stun that just shares the two clients data. The hard part is connecting the two clients, but that uses something called ICE. Thanks to selbie who posted this in the comments. That got me on the right track with ICE. I'll leave this question open for a bit longer in case somebody comes up with anything else. I'll start coding my own ICE code, or try and look for something online. Thanks!