muduo | driven network library for multi-threaded Linux server
kandi X-RAY | muduo Summary
kandi X-RAY | muduo Summary
Muduo is a multithreaded C++ network library based on the reactor pattern. Copyright (c) 2010, Shuo Chen. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the License file. Requires: Linux kernel version >= 2.6.28. GCC >= 4.7 or Clang >= 3.5 Boost (for boost::any only.). Tested on: Debian 7 and above Unbuntu 14.04 and above CentOS 7 and above.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of muduo
muduo Key Features
muduo Examples and Code Snippets
Community Discussions
Trending Discussions on muduo
QUESTION
I have read some code in muduo, an open source network library, and I found that the author use implicit_cat(int)
rather than static_cast(int)
in many place. The definition of implicit_cast
is as follows:
ANSWER
Answered 2020-Oct-23 at 09:07But why use
implicit_cast(int)
instead ofstatic_cast(int)
?
For the same reason as in the class case. In general, the reason is also the same as why C style casts are discouraged: Prefer using the cast which allows minimal set of casts that contains the cast that you want so that you don't accidentally perform a cast that you don't want.
QUESTION
I raised this question when reading the source code of muduo (C++ network library).
If a client sends a big size message which will be segmented by TCP, what happens in server side? (Does server know this message is already segmented?)
And is it necessary for network library to wait for the whole message and do not interrupt the upper layer?
...ANSWER
Answered 2019-Oct-10 at 11:04When dealing with a stream protocol like TCP, you already have to reassemble received data into chunks of your own choosing. That's either a fixed number of bytes per chunk, or it's decided dynamically by parsing the data in terms of your application's protocol (e.g. HTTP).
You don't know when you receive a packet from the network layer that it has been segmented: you only know that you received some data. You may know (because you understand your own protocol) that you're expecting more data to finish the chunk, but you won't know whether there is any more data until you receive it. If you do receive it.
Conversely, a single TCP packet may well contain more than a single chunk of your application-layer data! Again, you need to be aware that there is no direct relationship between the two things.
You can, however, depend on the TCP packets being delivered in the same order in which they were sent, which is nice.
Simple analogy: a big ol' ship, carrying cargo. It may be carrying 40 cars, or it may be carrying just half the quantity of parts required to construct an airplane. Or it may be carrying both! You don't know until you read the shipping manifest and consult your own records on delivery. It's then your responsibility to unpack what you've received and do what you need to do with it.
And is it necessary for network library to wait for the whole message and do not interrupt the upper layer?
If the library wants to pass a full "message" to the upper layer, then usually yes. Some approaches will just block waiting for a full message, but that's not common nowadays. Asynchronous I/O is your friend.
(This was a generic answer, written with no knowledge of what muduo does specifically.)
QUESTION
I am now working on imx6 platform, an embedded platform which have a qt enviroment.
...ANSWER
Answered 2017-Aug-04 at 01:49Check if add “-funwind-tables” with CC toolchain
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install muduo
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page