I´m using Official .NET Bindings for ZeroMQ (x86) 2.2.5 and cannot figure out how to set this Socket Option. Can anyone please shed some light on me ?
CLRZMQ is obsolete, NetMQ(https://github.com/zeromq/netmq) is now the official stack for windows.
in NetMQ use socket.Options.Mandatory = true;
CLRZMQ is not obsolete (see zeromq.org). The key difference between the two is in the approach:
CLRZMQ is binding project which actually uses libzmq library in background (it's a .NET wrapper for libzmq library);
NetMQ is .NET-native port of ZeroMQ, meaning that it does not wrap existing libzmq but rewrites it in pure C#.
Which one to use? Well, there's no simple answer. Here are few important things to keep in mind while choosing:
When it comes to portability - NetMQ wins by far, especially due to the fact that there's .NET Core version of NetMQ. Deployment is also easier with NetMQ - there are no native libraries to worry about (x64 / x86, etc.).
On the other side the fact that NetMQ actually rewrites everything is bit scary for me - there's always risk that something is not precisely mirrored from the original code, and that it may cause incompatibility with other ZeroMQ nodes. There's also question how fast NetMQ will implement new features from the original library.
Performances. At the moment I don't know which library wins in performances, but this is definitely thing to consider while choosing. libzmq should be significantly faster than any managed code, but in communication between CLRZMQ and libzmq marshaling has to take place, so I really can't predict which library will win in speed.
My solution contains many projects all of them are wrote on C#.
I need to transfer entire solution to C++ and Linux. Rewriting all projects will take a lot of time, so I want to do that one by one. I want to start with the most "common" project with basic classes.
I was thinking to start rewritting projects one by one on C++-CLI starting with the most "common" project (the basic project with basic classes that other projects use).
But everything will be finished it seems I will have a lot of CLI code that I assume is not portable to Linux?
So the main question is how intensive should I use CLI taking into account that I will need to run solution on Linux?
I can avoid CLI and replace it for example with zeromq, if it would be better.
upd This is HFT trading application, so mono is not acceptable. I want to have pure-c++, gc-free language as I plan to do a lot of optimizations (lock-free code, spin locks, probably using AVX and NUMA etc.)
the c++/CLI is Microsoft specific. It will not be portable. Also you will not get rid of the GC since the GC is a feature of the framework and not the language. C++/CLI is just another .net language with native code combined.
If you really can't use mono then tough luck. You will have to rewrite everything.
My questions is simple. After heavy googling I have learned that I can use ConcurrentDictionary in .NET 3.5 projects using Reactive Extensions and System.Threading.dll version from its install directory. First of all there is no System.Threading.dll, there is only System.Reactive.Windows.Threading in Reactive Extensions .NET 3.5 subdirectory. Adding reference to System.Reactive or System.Reactive.Windows.Threading or to any other from the mentioned .NET 3.5 doesn't give me ConcurrentDictionary class nor it gives me System.Collections.Concurrent namespace. I have downloaded older version of Reactive Extensions SDK and I have found what I have been looking for but my question is: does anybody know what happened to the ConcurrentDictionary backport in actual release of Reactive Extensions, does anybody know where it is or why it is missing. I was not able to find a reasonable answer or any answer at all.
We no longer ship the backport of the TPL with Rx for .NET 3.5. If you want to use the TPL and associated innovations in the field of concurrency, start using .NET 4 (or beyond). Rx itself doesn't need TPL functionality, hence there was no strong need for us to carry around the TPL.
There are too many complications with regards to supportability, maintenance, and quality associated with keeping such a backport alive. For instance, performance characteristics of the TPL on older CLR versions has never been tested much beyond the initial CTP of the TPL several years ago.
I'm considering porting an application from Java to .NET. This application makes a massive use of the NIO package which is totally non-existing in .NET.
One of the crucial differences, which is difficult to replicate on .NET, is the MappedBytesBuffer, since it is used to access an isolated portion of a file.
Could anyone help me finding out an alternative to replicate the functions? Thank you a lot.
If you can wait until .net 4.0, this might be useful:
What's New in the BCL in .net 4.0
Alternatively, you could roll your own wrapper for the Win32 apis CreateFileMapping and MapViewOfFile
I learned windows programming using Visual C++, and the Win32 API. Nowadays, it seems most apps are being developed in .NET using C#. I understand that most of the time there isn't much performance difference between native code and managed code. So I'm wondering, if I were to start writing a new desktop app today, is there any reason (other than the fact that I'm more familiar with C++), that I might want to write it in non-managed C++ instead of .NET? Are there still some advantages to using C++ and native code? Or has that method been more-or-less replaced with .NET on the Windows platform?
Of course I know that people who are writing low-level device drivers and similar programs wouldn't do it in .NET. I'm asking with reference to typical client-facing apps that don't make direct hardware calls.
IMO the most important one for small downloadable applications is that native code does not need the .NET runtime. While broadband becomes more and more common not nearly everybody has it yet.
Some people may be disappointed to see that your 2 MB application actually requires another 20MB of framework download and a bothersome installation process to run. If they are not sure whether or not they really need your application in the first place, they might just delete it before even giving it a try and turn to a competing product.
Performance (certain situations, such as graphics)
Memory footprint (as Mancuso said)
Use of existing libraries
No need for a runtime
Finer control
To list a few.
However, you may also want to look at the question from the opposite angle to fairly evaluate which language to use.
Additionally, you could use C++/CLI to incorporate both native and .net code.
If your application needs to be able to run without an installation (i.e. if you can't or shouldn't do something like install the .NET framework), you can't count on .NET being on a windows machine (pre-Vista). Lots of utility applications can fall in this category.
I would recommend to write every desktop application in managed code. .NET/C# is a great platform to do so.
My reasons:
Performance penalty is negligible. Google for benchmarks if you don't take my word. What matters more is the code itself. You can write O(n^m) algorithms in C++ or .NET/C#. JIT engines are very mature these days.
Unmanaged C++ has major drawbacks when it comes to unit testing, mocking and refactoring. It's very cumbersome and inflexible. Reflection allows managed code to make such things very convenient.
Deployment is a small issue. However, creating a setup which checks for the necessary .NET preconditions and installs them automatically is a no-brainer.
Compilation is quicker, no linker! It even happens in the background when you edit the code.
.NET library support is way better and cleaner than STL, MFC and boost.
No header files and macros. They are just error prone.
Security! Good bye buffer overflows, bad pointers, uninitialized variables...
Exceptions. Clear exception hierarchy in .NET. C++ exceptions are messed up.
Memory footprint. But unless you're developing for a severely handicapped machine memory-wise, it really shouldn't be an issue for most applications.
If you can afford the dependency on the stack, go for .NET
Modern, elegant, powerful and as a result much quicker to develop for.
But realize that you chain your app to it - to the language and the framework, if you forsee a future where you may want to escape this, then better think twice.
Win32 is old and clunky, but it works on virtually any Windows version without extra dependencies, and your code can be in plain, portable, C/C++.
+1 for not having to require a .NET package/install on the target machine(s). This is still a big issue.
When all machines have mono or NET it won't be such a big deal.
Two things that I can think of.
Protection of intellectual property. It's infinitely harder for someone to reverse engineer an Unmanaged C++ app. Managed .Net or Java apps can be easily de-compiled this is not the case with Unmanaged C++.
Speed. C++ is closer to hardware and has a smaller memory footprint as the other comment mentioned. This is why most video games continue to be written in C++ and inline assembly.
.Net programs also have a support lifetime, where native do not really. Native will run for many years across different OS's without requiring updates.
.Net programs can be hosed by bad .Net configuration, native just keeps on running and is hardly effected by OS updates.
.Net programs startup slow and feel sluggish, native starts quick and runs quick.
.Net has to be coded for lowest common denominator (most distributed framework version), Native compiles all code into application - so use what you want.
Use Delphi for Native, not C++. .Net is partially based on Delphi RAD and Java backend.