Giter Site home page Giter Site logo

daytime_server's Introduction

I decided to use Boost Asio to handle the sockets. It seemed like a good choice when looking for libraries for sockets and I was already familiar with boost.

Using the async versions of the recv, send and write method, we are able to handle multiple connections at the same time, letting asio handle the synchronization for us.

I left some debugging statements in the code to help figure out what is happening. I could have used a logging library, but felt it was a bit unecessary for the scope of this program.

Prerequisites

Project was built using the following libraries and tools

  • AppleClang 9.1.0.902003
  • CMake 3.12.1
  • Boost 1.68.0
  • XCode 9.4.1
  • Mac OS High Sierra (10.13.6)

Improvements

  • We could do more error verifications. For now, we simply check if there was an error, but in reality, we should have different behaviours based on error codes.
  • It might be a good idea to move the response generation from the parser.
  • We might generate an error code when the client sends an invalid command. We are returning "Invalid Command".
  • The commands could come from a configuration file instead of hardcoding them in a static object like we do in the Command class. This would be easier to change the format and add new commands.
  • I fixed the max buffer lenght for the request to 128 bytes. Since our commands have at most 8 bytes, it could be reduced.

daytime_server's People

Contributors

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