Giter Club home page Giter Club logo

tcp-relayer's Introduction

tcp-relayer

Node.js module to relay raw TCP data from one socket to another. Essentially, it should work like the following:

  • A server is started on some port
  • It waits for two TCP clients to connect
  • As soon as it receives two connections, it starts relaying data from the first socket to second one
  • Data is relayed until one of the clients disconnects

Pre-requisites

  • NodeJS version >= 6.9.1
  • NPM version >= 3.10.8
  • Telnet or any other tool that allows you to connect to remote computer over a TCP/IP network

Installation

$ npm install https://github.com/sarsjits/tcp-relayer.git

Usage

var relay = require('tcp-relayer');

relay.relayServer(portNumber);

Example

  • Use the above module in your Node app as mentioned in the usage. This will create a server listening over the mentioned port.

  • Run the app

  • Image 01

  • Now to connect to the running server, we will use telnet.

  • Client 1

  • Image 02

  • Server

  • Image 03

  • Sending message to the server even no other TCP client is yet connected.

  • Client 1

  • Image 04

  • Server

  • Image 05

  • As soon as another client connects to the server, buffered messages are sent to the client. The two clients can now communicate via server.

  • Client 2

  • Image 06

  • Server

  • Image 07

  • If the connection between two TCP clients is already established. The server will drop the new incoming connection.

  • Client 3

  • Image 08

  • Server

  • Image 09

Future Work

  • Extending to multiple pair of connections
  • Standalone app supporting Graphical Interface.

Suggestions

Provide the feedback at [email protected]

tcp-relayer's People

Contributors

sarsjits avatar

Watchers

James Cloos avatar  avatar

Forkers

pirumpi

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.