NAT Transversal - INDY / Delphi Source Code

Posted on 2014-08-02
Last Modified: 2014-08-10

Has anyone got some sample Delphi source code for NAT Transversal?

I am interested in getting our accounting application to run Peer-to-peer behind firewalls.  
It is already multi-tier with client / server using INDY.
Question by:enigmasolutions
    LVL 60

    Accepted Solution

    something useful may include
    - How do I use Indy with a NAT (Network Address Translator)?


    - Using Universal Plug And Play (UPnP) with Delphi (created a 'TNetworkDeviceFinder')
    thought 'pwnat' may be useful reference as it is in .c though not Delphi - most codes are in C#
    - pwnat, pronounced "poe-nat", is a tool that allows any
        number of clients behind NATs to communicate with a
        server behind a separate NAT with *no* port forwarding
        *no* DMZ setup, and no 3rd party involvement. The server
        does not need to know anything about the clients trying
        to connect.
    - chownat, pronounced "chone nat", allows two peers behind
           two separate NATs with NO port forwarding and NO DMZ setup
           on their routers to directly communicate with each other.
    - UPnP library that only covers the NAT aspects, and not even fully at that - only UPnP device discovery, basic port forwarding, and retrieving the external IP address.
    LVL 60

    Expert Comment

    Useful info

    There are several different techniques for dealing with routers - NAT Traversal, Hole Punching, uPNP, Role Reversal, just to name a few. Skype, and most other peer-to-peer apps, utilize many of these techniques
    Can I use Indy for dealing with routers?

    Yes (in fact, Skype for Windows is written in Delphi and uses Indy, actually). What I described earlier are techniques, logic patterns, etc. They are not specific to any particular socket library, so they will work with any socket library you choose to use, whether that be Indy, ICS, Synapse, WinSock, whatever. As long as you have access to base TCP/UDP functionality, you can utilize them.
    LVL 1

    Author Closing Comment

    Thank you.  That is great information.  Good enough for me to start the research.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
    This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now