GithubHelp home page GithubHelp logo

abhi-infrrd / node-tcp-hole-punching Goto Github PK

View Code? Open in Web Editor NEW

This project forked from samdecrock/node-tcp-hole-punching

0.0 1.0 0.0 8 KB

Node.js script to demonstrate TCP hole punching through NAT

License: MIT License

JavaScript 100.00%

node-tcp-hole-punching's Introduction

node-tcp-hole-punching

Node.js script to demonstrate TCP hole punching through NAT

How to

Run publicserver.js on a public server (not behind a NAT).

Run clientA.js on your first computer behind a NAT.

Run clientB.js on your second computer behind a (different) NAT.

Important: Run clientA.js first, run clientB.js second. (The only reason for this is that publicserver.js will show the correct debug messages).

Good Luck!

Output

Output should be something like this:

> (B->S) connecting to S
> (B->S) connected to S via 192.168.204.147 56504
> (B->S) response from S: {"name":"B","localAddress":"192.168.204.147","localPort":56504,"remoteAddress":"b.b.b.b","remotePort":56504}

> (B) 192.168.204.147:56504 ===> (NAT of B) b.b.b.b:56504 ===> (S) s.s.s.s:9999

> (B->S) response from S: {"name":"A","localAddress":"10.125.152.30","localPort":49468,"remoteAddress":"a.a.a.a","remotePort":33990}
> (B) time to listen on port used to connect to S (56504)
> (B->A) connecting to A: ===> (A) a.a.a.a:33990
> (B) listening on  192.168.204.147:56504
> (B->A) connection closed with err: ECONNREFUSED
> (B->A) connecting to A: ===> (A) a.a.a.a:33990
> (B->A) Connected to A via a.a.a.a:33990
> (B->A) data from A: Hello there NAT traversal man, you are connected to A!

node-tcp-hole-punching's People

Contributors

samdecrock avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.