S
S
Sergey Grigorov2018-07-30 16:56:18
Computer networks
Sergey Grigorov, 2018-07-30 16:56:18

Some questions about network programming in C++?

Hello. There are several questions about network programming in C++.
1. Data cryptography.
TCP is used to transfer data packets. Before sending data, it is planned to encrypt the transmitted data. What is the most secure key-based encryption algorithm you recommend in C++? Encryption will be end-to-end between each server, when a connection is established between servers, they receive a random key to decrypt data FOR THE CURRENT connection.
2. How would you advise to optimize the work?
The servers themselves work with TCP (raw sockets). What is the best approach to use to process data coming from server A to server B?
For example, information came from server A to server B with some kind of payment operation. We worked with the data, it is necessary to send the answer to the person who reported this information, but queues are not very suitable for this - it is advisable to use a process / thread for each connection. What's better? Or rather, HOW to implement?
I know the questions may seem silly, but I ask you not to throw slippers, but to give guidance and guide you on the right path.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2018-07-30
@Serjio-Grig

1. Use openssl, everything is already there for you. If you are making financial software for work in the Russian Federation, then GOST encryption will probably be required. There are also such options for openssl, with certification and other goodies, of course, not for free.
2. It's hard to say something here without knowing the specifics of the tasks that you will solve.
In general, flow per connection is when there are relatively few connections; otherwise, asynchronous I/O. But there may be other factors influencing the choice of architecture.
In the asynchronous version, the input / output itself can be done in one thread, and for processing, keep a pool of handler threads. Transfer tasks from the I / O stream to handlers through the queue, the results are similar.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question