NAT punchthrough capabilites

584 views
Skip to first unread message

Aidin Abedi

unread,
Aug 21, 2010, 12:12:31 PM8/21/10
to lidgren-ne...@googlegroups.com
Hi!

Can Lidgren determine whether a client/server is behind a router which is capable of a successful NAT punchthrough? I need to NAT test clients and servers individually from a MasterServer so that when a client requests the server list, the servers which are impossible for it to connect to (even with NAT punchthrough) are filtered out.

Raknet has a nice table of which router types can connect with their NAT punchthrough alogrithm: http://www.jenkinssoftware.com/raknet/manual/natpunchthrough.html.

/Aidin

lidgren

unread,
Aug 21, 2010, 5:19:42 PM8/21/10
to lidgren-network-gen3
The table is the same for lidgren - the algorithm is not specific to
raknet, it's just nat punchthru.

Check out the master server sample in the samples catalog how nat
punchthru is implemented in lidgren. Beware that it's not very battle
hardened code yet tho, so bugs may exist.

--michael

Aidin Abedi

unread,
Aug 24, 2010, 12:56:25 PM8/24/10
to lidgren-ne...@googlegroups.com
I already check out the sample. I don't see any code that checks before sending an NAT introduction whether it will be successful or not. The sample doesn't seem to determine what NAT type the client or server is behind. This feature is very important so that clients don't waist time trying to NAT punchthru a router that is impossible to connect to. And also to let a client or server know what their NAT type is so they can take appropriate action.

Do you know how I can impl a algorithm that determines the NAT capabilities of client or server before sending a punchthru?

Aidin

Aidin Abedi

unread,
Aug 24, 2010, 1:02:50 PM8/24/10
to lidgren-ne...@googlegroups.com
I have another question. Why is the internal IPEndPoint of the client and server needed to send a NAT introduction? Are they really needed?

Thanks!

lidgren

unread,
Aug 24, 2010, 1:09:28 PM8/24/10
to lidgren-network-gen3
NAT type detection would be a good addition to the library; however,
it does not change how you do punchthru and it takes just as long as a
regular punchthru - so it might be easier just to try punchthru and
send unconnected "ping" packets to determine if you can get thru. It's
quite possible to implement nat type detection on the application side
using unconnected messages if needed.

The internal IP is used to try to connect directly; for example if two
computer behind the same nat router tries to connect eachother.

--michael


On 24 Aug, 19:02, Aidin Abedi <aidinab...@gmail.com> wrote:
> I have another question. Why is the internal IPEndPoint of the client and
> server needed to send a NAT introduction? Are they really needed?
>
> Thanks!
>
>
>
> On Tue, Aug 24, 2010 at 6:56 PM, Aidin Abedi <aidinab...@gmail.com> wrote:
> > I already check out the sample. I don't see any code that checks before
> > sending an NAT introduction whether it will be successful or not. The sample
> > doesn't seem to determine what NAT type the client or server is behind. This
> > feature is very important so that clients don't waist time trying to
> > NAT punchthru a router that is impossible to connect to. And also to let a
> > client or server know what their NAT type is so they can
> > take appropriate action.
>
> > Do you know how I can impl a algorithm that determines the
> > NAT capabilities of client or server before sending a punchthru?
>
> > Aidin
>

Aidin Abedi

unread,
Aug 28, 2010, 8:29:47 PM8/28/10
to lidgren-ne...@googlegroups.com
Detecting a individual's NAT type would not only save time and frustration for a player looking for a connectable game server but would also let a server administrator know if his NAT type is impossible to punchthru.

How can I go about implementing NAT detection? Should I do it inside or outside of lidgren?

Sincerely,
Aidin

lidgren

unread,
Aug 29, 2010, 6:45:34 AM8/29/10
to lidgren-network-gen3
For easier integration with newer version; doing it outside lidgren
might be preferable. Just enable unconnected messages and start
sending.

--michael
Reply all
Reply to author
Forward
0 new messages