Skip to content

dantld/socket-dispatcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

socket-dispatcher

Project shows base example how to use base technique for sending tcp/ip socket to another process in Limux system. Also project shows how to make SSL connection over tcp/ip. Disgram below shows simple scheme with clients hosts snd server host.

Host has two type of processes:

  • Listener, see source mylsnr.cpp for details.
  • Dispathcer, see source mydisp.cpp for details.

The remote process,

  • Client, see source myclnt.cpp for details.
                              ┌─────────────────────────────────────────────────────────┐
                              │                                                         │
                              │                                                         │
                              │                                                         │
                              │                                     ┌─────────────┐     │
┌────────┐                    │                                     │             │     │
│        │                    │                                     │ Dispatcher  │     │
│        ├──────────┐         │                           ┌─────────►             │     │
│Client  │          │         │                           │         │             │     │
│        │          │         │  ┌────────────────┐       │         │             │     │
│        │          │         │  │                │       │         │             │     │
└────────┘          │         │  │                │       │         └─────────────┘     │
                    │         │  │                │       │                             │
                    │ TCP/IP  │  │                │       │                             │
                    └─────────┼──┤                ├───────┘                             │
                              │  │ Listner        │ UNIX Socket                         │
                              │  │                │                                     │
                    ┌─────────┼──┤                ├────────┐                            │
                    │         │  │                │        │                            │
                    │         │  │                │        │        ┌─────────────┐     │
┌────────┐          │         │  │                │        │        │             │     │
│        │          │         │  │                │        │        │ Dispatcher  │     │
│        │          │         │  └────────────────┘        │        │             │     │
│Client  ├──────────┘         │                            └────────►             │     │
│        │                    │                                     │             │     │
│        │                    │                                     │             │     │
└────────┘                    │                                     └─────────────┘     │
                              │                                                         │
                              │                                                         │
                              │                                                         │
                              │                                                         │
                              │                                                         │
                              │                                                         │
                              └─────────────────────────────────────────────────────────┘

Build and run.

mkdir build && cd build && cmake ..
../scripts/genkey.sh
./mylsnr -a ca-web.crt -c dispatcher.crt -k dispatcher.key -p ./

From another console run the client example.

./myclnt