Boost::ASIO VS Qt networking - c++

I want to make some networking application.
I wanted to use Qt, but it's networking library is relatively big
and then I tried to learn Boost::asio, but it seems to have the same amount of size
What is a library that has small footprint? As small as can be?
Can I use Boost:ASIO or Qt and somehow streamline them to be little in size?
I need my application to be smaller than 1MB, (or even smaller if could be)

You can use the standalone version of asio in header only mode. Or you use the OS interface directly.

Related

What libraries can I use to make tiny Windows programs?

Perhaps some of you people have heard of http://suckless.org/ and their set of Unix tools. Basically, they're a set of programs that each aim to do one thing but do it well, while still being as simple and resource-light as possible.
I've been trying to find a way to reproduce this style of programming on Windows with C++ but all the libraries I know of would produce binaries that are huge with respect to their function. Even the simplest of anything Qt, for example, is generally several megabytes large. I'm not against packaging dependencies along with distributables but I wouldn't want to do it to that level.
Binary size is not one of my main goals but simplicity is and big libraries like these are, by construction, not simple. If binary size were your primary concern you could use runtime compression just like kkreiger or malware.
A possibility would be to go commando and use only ISO Standard C++ libraries but rebuilding a sockets or networking system for a small single-purpose application is not really something anyone would want to be troubled with.
For some reason I thought there was some general-purpouse library that Windows developers could count on everyone and their grandma having readily accessible but now I don't know if anything like that exists. What can you use to write code that adheres to the Unix Philosophy but for Windows targets?
You should target the Win32 API directly. You can't get much lower level than that. In the Windows world, everything directly or indirectly wraps the SDK functions, including the so-called "standard C++ libraries".
Alternatively, you could use something like MFC or WTL, which are relatively thin C++ wrappers over the Win32 API. Because of the overhead of the class libraries, such programs will be slightly smaller than those created using only the SDK, but nowadays, the actual overhead is completely insignificant.
The desires expressed in your question are precisely why I learned and still use the Win32 API today, so that's definitely what I would go with. Plus, your programs will look and feel native, which is way better than the crap most "cross-platform GUI toolkits" put out. The advantages of this can't be underestimated.
But if you just open up Visual Studio and compile a simple little SDK "Hello World" app, it'll still be awfully large. Kilobytes, to be sure, but that still seems like a lot for about the simplest app imaginable. If you really need to cut things down further, you can try telling Visual Studio not to link to the C runtime libraries and define your own main entrypoint. This does mean that you'll have to implement all of your own startup initialization code, but this can reduce the size of a trivial app substantially.
Matt Pietrek had this same idea some years ago, although you'll probably want to take time to "modernize" his original code significantly if you decide to go this route.
FLTK is a popular cross platform minimal gui toolkit.
Or a popular alternative if you don't need too much detailed interaction is just to fire up a minimal embedded webserver and do all the 'gui' in html in a browser.

Small native cross-platform GUI framework for C++

I wrote a small program with Boost in c++. It works fine and so I want to give it a graphical interface so that it is easier to use.
In order to do so, I am looking for small cross-platform framework which provides native look and feel. Windows and Linux support would be enough, currently i do not need os x...
I used wxWidgets for some other project, but it was a pain to set everything up and ship this big library with the software.
But I was really amazed by the use of real native controls.
In order to keep the program small I also tried fltk, but it has an awful look.
I just need an simple framework without network support or other gimmicks.
So my question: Is there any framework out there which fits all the requirements? Or if not, which frameworks fits at least some of these needs?
Thanks in advance!
When it has the word "framework" in its name it's almost never small.
Anyway, graphical frameworks/libraries tend to be big, cause they need to handle a lot of stuff.
Qt is probably the best straightforward library for cross-platform GUI, but it definitely doesn't constitute a "small framework". On the other hand, on Linux systems, Qt will be most likely already installed. Plus it definitely pays for its size.
wxwidgets is fairly small as far as gui toolkits go.
And it's cross platform
http://www.wxwidgets.org/
You have mentioned it, but as far as cross platform toolkits go it's one of the smallest I've seen.
The only other suggestion I have is that you could wrap your code up into a C library and link that into another language. e.g. Use .NET on windows and mono for linux or even a java based app (although they don't always look very native to the platform). Then use your library from there.
Ultimate++ might contain what you need. (Although they make it sound in the FAQ as if their library is really big, it doesn't seem that bad to me.)
don't forget to check juce as well
Qt works amazingly, but is not very small. I've found there is a genuine lack of "small" cross-platform GUIs. You either might try to just abstract your GUI with #ifdefs all over the place, or use Qt/wx.
If you want it to be small, just write the GUI twice -- once in MFC and then in X. Your GUI sounds simple enough. Build up your own small abstraction that is just what you need.
There is a long list of both active and dead cross-platform C++ UI libraries here: https://philippegroarke.com/posts/2018/c++_ui_solutions/
Some of them are small and have a native look.
Like others mentioned you cannot mix the "cross platform" and small in size in the same sentence.
More work, smaller in size:
One solution I can suggest is to use native python binding for the UI portion. Since you are already using boost, it should be fairly trivial to have Boost.Python communicate between C++ space and python space. You already have python on Linux and its a 20-40MB package on Windows (can't remember how big the latest release is). But here you will have to use win32 binding on windows and gtk/qt bindings on linux, so more work. Nah, too much work to maintain, scratch this.
Moderate work, smaller in size but with non-native controls:
You can try to get clutter or freeglut to get your UI work done but I personally haven't used them so I don't know if they provide full native looks for your apps. But they are small in size compared to wx or qt.
Less work, bigger in size:
Use WxWidgets if you are already comfortable with it, otherwise I recommend Qt.
You can also have a look at some of the other offerings: http://en.wikipedia.org/wiki/List_of_widget_toolkits
Clutter: http://www.clutter-project.org/about
FreeGLUT: http://freeglut.sourceforge.net
ever heard of QT ???
http://qt.nokia.com/products/
i think it should fits all your your needs

I wanna make a UDP communication between two or more computers

I need to make a connection through wireless or LAN. I have done this on Windows (VS2008 C#, Sockets), but not on Linux (Ubuntu 10.04). I have installed mono, and I can handle many things there, but it's speed is unacceptable for my 600MHz processor, so I decided to move on C++, but I'm new to C++ and I'm not familiar to many of it's headers. Is there any header or library which can do that for me?
How the actual connection is done (if wireless or cable) should be up to the system; if you want to use sockets, I suggest reading of beej guide to network programming , it contains everything (or so) you need to know. It's C mainly, but reusing it for C++ needs no effort.
Did you think about using boost::asio, this way you can share at least the code between linux & windows. The overhead is not that big compared to naked sockets and you have the benefit of better semantics. Many parts of code from boost have flown into standard C++ so the code is of rather high quality.

What C++ library to use to write a cross-platform service/daemon?

I wonder what library would ease the development of a cross-platform service/daemon ? (C/C++)
I'm targeting: Windows, Linux and OS X.
Requirements: network operations and serial port communication.
Also it would be nice to have a basic sample service application.
When it comes to Qt you might try qt-service.
A daemon in Linux is really just a process that runs disconnected from a terminal. In Windows, a service is something that can be controlled using the service management API, but once again is basically just a disconnected process. The disconnection aside, daemons & servers don't have much in common, from task to task. There is no requirement, for example, that they be multi-threaded, be asynchronous or perform network I/O. Given that, it's kind of hard to see what a cross-platform library would do.
You should take a look POCO. Depending on what you are doing it could have facilities to do a large amount of the work for you with a lot less work than Boost.
An obligatory mention for ACE though I don't personally care for it much.
Boost probably has most of what you need in terms of threading and networking I/O.
You may also find Qt a good alternative. It also has threading and networking libraries and has a much easier to use & understand event-driven programming model using a run loop. Qt's signal/slot system is very easy to use and ideal for a network daemon/service (Boost also includes a signal/slot system but it is harder to use and does not include an event loop; you have to roll your own using some event library). As a cross-platform library, Qt can handle many of the issues in bridging the Unix (OS X and Linux) vs. Windows mental model for processes, filesystems, etc.
For unit testing, I've been very happy with Google's C++ unit testing library called googletest (though both Boost and Qt also have built-in unit testing systems). It runs on all the platforms you specify. I've done a lot of work with googletest on cross-platform Qt projects and found it quite satisfactory.
I've found a big library in the non-boost version of ASIO. You don't need all boost library but only this little headers-only and very well documented library http://think-async.com/
As examples, a daytime server-client system is implemented in very few lines of code.
Take a look at it.
(remember to look at the non boost-ized version)

Recommend crossplatform C++ UI and networking libraries

Things to take into consideration:
- easy to use
- fast
- use underlying OS as much as feasable (like wxWidgets for UI)
Ones I am leaning towards are wxWidgets for UI and Boost for networking - how do they compare to others?
I hear good things about qt for GUI
Qt is a cross-platform application and
UI framework. Using Qt, you can write
web-enabled applications once and
deploy them across desktop, mobile and
embedded operating systems without
rewriting the source code
I've had good look with wxWidgets on the front end and boost::asio on the network end.
wxWidgets does have network classes built in, but you hit the wall quickly on them, and there's one or two big limitations. If you want to stay in the wx world, there's a package called wxCurl which is a fine package (I used it in the early days) that wraps libCurl with some wxWidgets idomatic C++.
In a previous project of mine (a network/file transfer heavy project) we ended up going with boost::asio, which had the advantage of not being all that hard of an API, easier-seeming to set up that libCRUL (although that may have gotten better, that was been several years now), and gives us a very generic networking core (boost can compile anywhere, even command line apps)
For GUI I would strongly recommend using Qt. It is very powerful GUI framework that requires writing very few lines of code. It has very nice and easy to use model of signals and slots.
wxWidgets IMHO too modeled after MFC which has very bad model.
Networking: I would suggest go for Boost.Asio very powerful and nice. However if you
want to integrate networking to GUI main loop you may try to use Qt classes for that, however I have no experience with them.
I've used XVT historically, which has been used commercially by thousands of companies.
Both Qt or wxWidgets can do networking even if it's not their first goal.
For more network centric libraries, apart from boost::asio, you can check ACE (Adaptative Communication
Environment ) or POCO
Comparisons between these libraries have already been discussed on stackoverflow.
boost::asio seems to be very well written, and has a very clean API -- I am still trying to learn how well it is for shared-nothing multithreaded TCP/IP.
Your other choices might be Poco, or ACE. Poco's socket abstraction is quite naive --i.e., it only allows the Poco way of doing things. I've never heard anything good about ACE.
edit: Hmm, I'm re-examining ACE and its making more sense to me now (after having written a few networking apps) -- it might be suitable for my needs compared to ASIO. However, it is more than likely overkill for you. If my peers find out about this, I will be shunned till the end of time.
We have had good success using wxWidgets with boost::asio, both recommended for desktop-server development.
For GUI, I can recommend QT
For Networking ACE (Adaptive Communication Environment) or boost::asio.