Client/server networking library
BlitzMax Forums/BlitzMax Programming/Client/server networking library
| ||
I posted the networking library and chat program I have been working on here: http://blitzmax.com/codearcs/codearcs.php?code=2639 It actually handles quite a bit. I am very pleased with how this turned out. |
| ||
This looks quite useful actually, well done, and thanks for sharing. Does it deal with the `behind a router` problems that many people talk about? |
| ||
As far as I see not. But thats also kind of enet normal, as ENet has no NATPunchthrough and connection tester capabilities to host corresponding servers to offer that for your game. |
| ||
I found out even raknet handles NAT punch through with a third-party lib. Maybe someone can modify this to do something like that? I'll keep posting the code until I get to the point where it becomes too specific to my engine. |
| ||
Very nice of you sharing this code. And I'm looking forward to see this in your engine someday. :-) |
| ||
Are you guys talking about this: http://en.wikipedia.org/wiki/UDP_hole_punching? I've successfully used ENet for this type of connections from within a NAT. What I have tested is this: 1.) Client behind NAT on my 3G connection. 2.) My router on my normal broadband connection configured to redirect UDP-packets sent to a certain port to the computer where the server runs. 3.) The client and the server thus on completely separate internet connections where the 3G doesn't even have a public address. Naturally the client has to initiate the connection to the server to do the initial UDP hole punching. This works absolutely perfect with an ENet connection. I hope I talk about the same thing as you do. edit: clarification |
| ||
Sorry to drag up this old thread, but Mahan do you have any example code of NAT punch through using ENet that you'd care to share? I'm trying to do exactly that at the moment but can't find any example code anywhere. Googling just brings up examples of people saying it's possible followed by vague descriptions of how to do it. |
| ||
It's been a while so if what I say sounds uninformed it might be that I'm getting old and senile :) Anyways from what I remember (also read the wikipedia article): NAT hole punching is a pure NAT/Masquerade trick. UDP over IP is simple sending of datagrams, right? When the first datagram is sent from the client and arrives at the server its got info about sender (clients) IP and PORT. Almost all firewalls today support hole punching which simply means that if the server sends a datagram back to the sender IP and to the same PORT the firewall relays this package to the client computer (behind it's firewall). This is nothing you should need to worry about if you use ENET. I'm sorry I don't have any sample code available but in the BMX forum i posted about MagNet once (my own "overlay" on top of GNet in BMX which in turn is an "overlay" to BMX ENET.) http://blitzmax.com/Community/posts.php?topic=81799 I got this to run through my firewall at the time without any forwarding configuration on my part. I also got it to run from my 3G through Internet to my normal home cable connection (where the server was located). (The thing is that my 3G didn't provide any external IP-address but rather a 10.X.X.X internal address from my 3G-ISP.) Based on this I'd assume ENET works with hole punching. edit:spelling Last edited 2011 |