P2P NAT Sample

Overview of the P2P NAT Sample.

2 mins to read

The P2P NAT sample demonstrates Peer-To-Peer communication between users using NAT-traversal via the P2P Interface. To help determine if the user can easily connect to peers, the P2P Interface can query the local user's NAT Type in relation to the internet, the sample shows this status for the logged in user. See the NAT P2P Interface documentation for more information on implementing and using the NAT P2P Interface.

Before You Begin

The sample application uses Epic Account Services to authenticate the local user for demonstration purposes. This requires that the Client Credentials used to initialize the SDK have been assigned to an Application used for Epic Account Services.

The demonstrated SDK functionality can be used with any of the supported identity providers for user authentication.

NAT Status

After logging in you will see one of the following NAT Status states shown:

NAT StatusImageDescription
UnknownUnknownNAT type either unknown (remote) or we are unable to determine it (local).
OpenOpenAll peers can directly-connect to you.
ModerateModerateYou can directly-connect to other Moderate and Open peers.
StrictStrictYou can only directly-connect to Open peers.


To illustrate communication between users there is a basic chat system included with this sample to allow you to attempt to send and receive messages between users. To attempt to initiate a chat with a friend, click on the "CHAT" button next to their name in the friends section as shown below:

To chat click on the chat box (above the console) and type a message then hit ENTER to send the chat message as shown below:

The messages sent by you and received from friends will appear in the box in the top-left as shown below:

To close the current chat session, click on the "CLOSE CHAT" button.

Console Panel

To view log output from the program's operation, including the results of console commands, use the console panel included with this sample on the lower-left side of the user interface. You can enter console commands at the bottom of the console panel.

The console panel for the P2P NAT sample. Click image to enlarge.

Enter the HELP command into the console to print the list of available commands.