Code Monkey home page Code Monkey logo

client-server's Introduction

Client/Server

About

The applications were implemented in C++ using sockets API as a school project. The applications were developed and tested on FreeBSD server.

The location of files on the server side is in the server's current directory (directory where the server is running from ). Downloaded files are saved into client's current directory.

Limitations of the server

  • max length of a request is 4096 bytes
  • can handle max 5 clients simultaneously

Protocol description

The protocol message consists of attributes divided by the newline character. A sequence of two newline characters is at the end of a message.

Request The first attribute has to be a type of the operation to be executed.

  • 0 (request to upload file)

    • required attributes:
      • File:(file name)
      • Length:(length of the file to be uploaded in bytes)
  • 1 (request to download a file)

    • required attributes:
      • File:(file name)

Server response

  • 2 (request was successfully accepted / upload was successful)
  • 3 (NACK = unsuccessful upload operation)
  • 4 (File was not found)
  • 5 (Unknown request)
  • 6 (Request is too long)
  • 7 (Missing required attribute)
  • 8 (Server is overloaded at the moment)

Request example for upload operation 0\n File:file.txt\n Length:42\n

Request example for download operation 1\n File:file.txt\n

Run the server

make server
./server -p <port number, where server will expect a connection>

Run the client

make client
./client -p <port number, where client will create a connection> -h <server host name / IP address>

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.