Giter Club home page Giter Club logo

echoapp's Introduction

TCP and UDP echo app – client and server in one

This is a simple TCP and UDP echo server and client, designed for testing container lifetime and reachability.

In server mode, it listens on both TCP and UDP on the port specified by the PORT environment variable. It reads data sent by clients, and echos back the data along with some additional context that's useful for debugging.

In client mode, you specify the protocol (TCP or UDP), the target host and an interval, and it will create a new connection for every echo request.

Features

  • Client and server in one binary (controlled by env vars)
  • TCP and UDP mode for both client and server
  • JSON logs with lots of detail
  • SIGINT/SIGTERM handler with extra logging
  • The AWS ECS task ARN is included in the logs, if available

Configuration

All configuration happens through environment variables:

  • APP_MODE (default: client) – client or server

  • PORT (default: 2222) – the TCP/UDP port to use

  • CLIENT_PROTO (default tcp) – tcp or udp

  • CLIENT_TARGET_HOST (default: 127.0.0.1) – hostname or IP to target in client mode.

  • CLIENT_CONN_INTERVAL_MS (default: 1000) – connection interval in milliseconds

  • HANDLE_SIGNALS (default: unset) – if set to any value, SIGINT and SIGTERM are caught and timing info is logged every 200 milliseconds for as long as possible

Non-configuration

Some things are not yet configurable:

  • Client TCP/UDP dial timeout is 800 milliseconds

  • Client/server TCP/UDP read/write timeout is 800 milliseconds

  • Client/server read buffer is 4 kB

Known issues

  • Go issues spurious SIGURG signals that can be a bit noisy.

echoapp's People

Contributors

sveniu avatar

Watchers

 avatar  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.