Giter Site home page Giter Site logo

ping-pong's Introduction

ping-pong

Requirements

Please provide us with a complete C or C++ program in source code form which meets the following requirements. The program should implement a ping/pong behaviour using TCP as the transport mechanism. It should accept the following command line switches:

  • -s server mode
  • -c client mode
  • -t (client mode only)
  • -p
  • -m

The ping and pong packets should be in the following format:

Additionally:

The client should send a ping packet once a second with an incrementing 64-bit index. The server should respond to the client with the received index and its own message string. Both the client and server should print to stdout the index and message string for each packet that they receive. The program should be able to handle improper inputs gracefully and provide feedback to the user. The program should handle errors gracefully and provide feedback to the user. The program should be able to compile and run using gcc or g++ on a recent x86 or x86_64 Linux distribution (Debian, Ubuntu, CentOS/Red Hat). The program should be able to compile with the following flags: -Wall, -Werror, -Wshadow, and either -std=gnu99 or std=gnu++98 as appropriate for the compiler. Include a Makefile.

Build

make

Resulting binary will be at .bin/pingpong

Usage:

Ping-Pong commndline tool. Usage:

  • -s server mode
  • -c client mode
  • -t (client mode only)
  • -p (between 1024 and 65535)
  • -m (between 1 and 255 chars in length)
  • -h display this help message

Example usage:

Server

bin/pingpong -s -m "Pong from server" -p 4321

Client

bin/pingpong -c -m "Ping from client" -p 4321 -t 127.0.0.1

ping-pong's People

Contributors

cbenning avatar

Watchers

 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.