Tuesday, July 21, 2009

NAT Traversal for Android

STUN (Simple Traversal of User Datagram Protocol through Network Address Translators) is a protocol that helps in the traversal of NATs/Firewalls. STUN works with full cone NAT, restricted cone NAT, and port restricted cone NAT. It does not work with Symmetric NATs. Traversal Using Relay NAT(TURN) maybe used in these cases. Another method for traversal is ICE (Interactive Connectivity Establishment). Here, I am focusing on NAT traversal for Android phones using STUN

  • jStun
  • stun4j
These are two STUN libraries available for the Java language. A jStun port is available from HSC. I've tested this on the Android Emulator. It returns an IP address and port mapping.

stun4j is another STUN library. This I tried directly on the Android emulator with no porting. It works directly with no code changes. I have compared results from both the libraries. Results are the same!!!


1 comment:

  1. Hey can you post the code you used for testing the jStun port for Android by HSC. The jStunDemo.java file provided by them has nothing.

    ReplyDelete