Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you're going to use C++, I second "the_mandrill" above by strongly recommending you look at ASIO in Boost - that is a great way to write the code once and support both platforms.</p> <p>As to whether or not C++ is the right language is rather more subjective. My personal feelings are that if you need to ask, odds on, it's not the best approach.</p> <p>Reasons for selecting C++ to implement networking code are:</p> <ul> <li>Possible to achieve very low latencies and high throughput with very carefully designed and implemented code.</li> <li>Possible to take explicit control of memory management - avoiding variations in performance associated with garbage collection.</li> <li>Potential for tight integration of networking code in-process with other native libraries.</li> <li>Potential to build small components suitable for deployment in resource constrained environments.</li> <li>Low level access to C socket API exposes features such as socket options to use protocols beyond vanilla TCP/IP and UDP.</li> </ul> <p>Reasons for avoiding C++ are:</p> <ul> <li>Lower productivity in developing code compared with higher-level languages (e.g. Java/C#/Python etc. etc.)</li> <li>Greater potential for significant implementation errors (pointer-abuse etc.)</li> <li>Additional effort required to verify code compiles on each platform.</li> </ul> <p>Alternatives you might consider include:</p> <ul> <li>Python... directly using low level socket support or high-level Twisted library. Rapid development using convenient high-level idioms and minimal porting effort. Biggest disadvantage - poor support to exploit multiple processor cores for high-throughput systems.</li> <li>Ruby(socket)/Perl(IO::Socket)... High level languages which might be particularly suited if the communicated information is represented as text strings.</li> <li>Java... garbage collection simplifies memory management; wide range of existing libraries.</li> <li>CLR languages (C# etc.) also garbage collected - like Java... WCF is an effective framework within which bespoke protocols can be developed... which may prove useful.</li> </ul> <p>You also asked: "<em>I understand that I'll have to use Microsoft's Visual C++ library, as it seems as though it is hard to utilize C++ code from C#; is this true?</em>"</p> <p>You can avoid Visual C++ libraries entirely - either by developing using a language other than C++, or using an alternate C++ compiler - for example Cygwin or MinGW offer G++... though I'd recommend using Visual C++ to build C and C++ code for Windows.</p> <p>It's not hard to use C++ code from C# - though I don't recommend it as an approach.. it's likely overly complicated. Visual C++ can (optionally) compile "Managed Code" from C++ source (there are a few syntax extensions to grasp and there's a slightly different syntax for interoperation using Mono rather than Visual C++, but these are not major issues IMHO.) These CLR objects interact directly with C# objects and can be linked together into a single assembly without issue. It's also easy to access native DLLs (potentially written using C++ for the native architecture) using Pinvoke. All this is somewhat irrelevant, however, as the .Net framework has good support for low level networking (similar to that provided by Winsock[2]) in system.net - this provides a convenient C#-oriented interface to similar facilities, and will likely provide a more convenient API to develop against if using C# (or VB.Net or any of the other CLR languages.)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload