A
A
antonchig2014-01-31 21:33:44
C++ / C#
antonchig, 2014-01-31 21:33:44

What to read to gain knowledge of server-side C/C++ programming?

I wrote an application for iOS, now we need to write the server part. For the efficiency of request processing, I think to write in C / C ++, but since in network programming I am an oak oak, what can I read? I would like to have a general idea of ​​how request processing works synchronously / asynchronously, or maybe in some other way.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
nekipelov, 2014-01-31
@nekipelov

A classic of the genre: UNIX Network Programming by Richard Stevens. There is a lot of useful information there. Even if the server will run under Windows, most of this and=information will be up to date. Well, after reading, be interested in such things as epoll and kqueue.

D
Dmitry, 2014-02-02
@hsc

A lot depends on the communication protocol you choose for your application. If you manage to tune the data stream to http, then it might make sense to look at technologies other than C/C++. For example, as an option, you can look at python. A lot of http-servers of all stripes are implemented for it. This choice is good because, firstly, it will allow you to quickly write a system prototype, even if you are not familiar with python, because you do not have to learn the basics of the network, but it will be enough to use high-level abstractions, which means that the time to study the network can be will spend on an additional YaP. Secondly, you can much more easily and quickly install third-party applications like redis, memcached, all kinds of databases, etc. Thirdly, this option is good for easier scaling. You may also be advised python and say that if necessary, speed-critical parts of the program can be rewritten in C, but my advice to you is to consider this argument last. But this option is not without drawbacks: the speed of python is much slower than C / C ++. In my practice, there was a case when python dipped in calculations by ~ 50 times. Here a lot depends on the tasks of the server. Secondly, more resources are consumed. Get ready for 5-10x gains. Secondly, more resources are consumed. Get ready for 5-10x gains. Secondly, more resources are consumed. Get ready for 5-10x gains.
By itself, http will already be able to guarantee the delivery of data and impose some correct restrictions on their flow. In addition, it will make it easier to manage caching, which is also important.
If you still decide to write your protocol based on TCP/IP or UDP, take a look at boost::asio . In the world of C++, it has established itself as a fairly fast and efficient toolkit for working with the network. His documentation is mediocre, you will often need to run around the forums, but the main things are described normally. There are examples. Also, for a quicker entry into the topic of network programming while skipping the nuances of very low levels, you can take a look at the networking documentation in Qt. Many nuances are described there, very good examples are given, you can peep a lot of good practices in designing network subsystems.
Finally, I will say that if the choice falls on C / C ++ due to the possibly greater performance, then do not forget that only part of the performance depends on the network, but there is also memory management, resources, server tasks (read threads), etc. d. Are you ready for this?

A
Alexander, 2014-02-01
@alexyat

I can advise the same obj-c, because You are already familiar with it, you will quickly write your own web service objective-cloud.com - it's paid. There are a lot of open source libs that can be found through Google for the objective c web request, and then get yourself a vps or dedicate with mac os

A
AxisPod, 2014-02-04
@AxisPod

It will not be easy to immediately implement a serious network solution in C++, even with the use of ready-made libraries. Maybe it's easier to take node.js? It works asynchronously, the main thing is to understand the model of asynchronous work. In fact, boost::asio also works asynchronously. First, it’s really worth trying asynchrony on node.js, a day is enough for this, then look at examples of using boost::asio, there are a lot of examples in the library of examples and then decide. But it will definitely not be easy, various stones will constantly climb, there will be memory leaks, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question