Code Monkey home page Code Monkey logo

non-blocking-server's Introduction

non-blocking-server

Just a little test. How could be a non-blocking server.

RunServer class autokills server after some thread sleeping time.

Some interesting ideas from https://jenkov.com/tutorials/java-nio/non-blocking-server.html

An example of client for this server is https://github.com/xsalagarcia/non-blocking-client-for-non-blocking-server

Server can't detect disconnected clients. Disconnection message should be established and SocketProcessor.deleteNonConnecteds() could be modified.

Connection protocol



Client                                                        Server
======                                                        ======
                        Connect
          --------------------------------------------------> Server creates a welcome message
                Public key + client socket Id in a WELCOME message
          <-------------------------------------------------
client generates
SecretKey (private) with
client socket Id, random
integer and shared client-server 
integer.  

Client sends SECRET: generated random and SecretKey in byte[]
               encrypted with public key.
           -------------------------------------------------> Server calculates MAC (key for
                                                              MAC with: server socket Id + 
                                                              shared client-server integer +
                                                              random client integer.
All exchanged messages now will be sent with stablished client private key and the MAC will be check.
             Server sends calculated MAC (CHECK_WELCOME message)
          <-------------------------------------------------
Client compares
his MAC with received MAC.
If it fails, stops connection.

More interaction requires loggin:
Client sends User name + password with LOG_IN or NEW_USER message.
           ------------------------------------------------->
             Server sends ACK or NACK and the client is logged or not.
          <-------------------------------------------------
          

non-blocking-server's People

Contributors

xsalagarcia avatar

Stargazers

 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.