[CISYSTEM] [MULTI THREADING] [SOCKET]
[DESIGN PATTERN] [SINGLE RESPONSIBILITY PRINCIPLE]
I have started with the implementation of the NetworkLayer and PaketLayer of CISystem and I am very happy with my PacketLayer and the whole communication concept. It shows that decoupling the layers by using communication via packets makes the implementation much easier than I had expected, because I only need to implement layer by layer and for every layer only its duties and not all duties of a complex system in one class.
The single responsibility principle rocks again!
While working on the implementation I have found out I missed to describe in detail how the sockets are created, means
This overview fills the gap :
First the main thread will read the network configuration from a JSON file and create a packet for every connection. The list of packets is passed to the PacketLayer, which passes it to the SocketConnectionApplication thread, which creates sockets for sending packets. These sockets try to connect with SocketServer threads.
The SocketServers accept the connections and create SocketClient threads for receiving packets.
When a receiving SocketClient receives a packet, it sends it to the PacketLayer. The PaketLayer sends it to the SocketCommunicationApplication to check if the connection is already set up for sending packets. If not, the SocketConnectionApplication creates the socket for sending packets.
The Blog
|
|
|
|
My Technical Blogs
|
|
|
|
|
|
|
|
|
|
|
|
Projects
|
|
|
|
Blogs Of Friends
|
|
|
|
|
|
CV/About
|
|
|