VC++ Vs .Net

M

Mubashir Khan

Ok ... Ok hold on. This is not the same old discussion. But it still is. I
am creating an application which would open 100+ sockets. Every socket would
be emulating a user for a telnet connection thus response should be real
time. This is the reason i have created one thread for each socket. I
remember I/O completion port can be used to create fewer threads using
thread pool, but i would be researching for it and i have got very little
time to complete it. My Question, I want better performance and less
computer resource usage. What do u guys suggest ........ VC++ or .Net
 
P

Peter Duniho

Mubashir Khan said:
[...] I remember I/O completion port can be used to create fewer threads
using thread pool, but i would be researching for it and i have got very
little time to complete it. My Question, I want better performance and
less computer resource usage. What do u guys suggest ........ VC++ or .Net

According to the .NET documentation and statements posted here by others,
the non-blocking implementation of the .NET Socket class uses IOCP. If your
goal is to use IOCP, it seems to me that using .NET is probably one of the
easiest ways to do that, since it's Socket API is fairly simple.

Implementing IOCP code in regular C++, using only Winsock and without the
assistance of 3rd-party libraries, is not only a chore, it's complex and
fraught with potential pitfalls and opportunities for errors.

If coding IOCP using plain C++ and the Win32 Winsock API is within your
capabilities, then using the async methods in the Socket class should be
trivial for you. We're talking weeks to get it right under C++, versus a
day or so under .NET (more or less, depending on your actual capabilities as
a coder).

Full optimizations and possibly other details may take longer, of course.
I'm just talking about the basic implementation. But that may well be
sufficient for your needs, and even if it's not, I suspect that any extra
stuff will have a similar relative cost using Win32 versus .NET.

Pete
 
C

Carl Daniel [VC++ MVP]

Mubashir said:
Ok ... Ok hold on. This is not the same old discussion. But it still
is. I am creating an application which would open 100+ sockets. Every
socket would be emulating a user for a telnet connection thus
response should be real time. This is the reason i have created one
thread for each socket. I remember I/O completion port can be used to
create fewer threads using thread pool, but i would be researching
for it and i have got very little time to complete it. My Question, I
want better performance and less computer resource usage. What do u
guys suggest ........ VC++ or .Net

It's not an either-or proposition. The .NET sockets implementation uses
IOCPs for async operation and is very highly scalable - use it.

Whether you use it from C++, C# or any other .NET language is a completely
separate decision.

-cd
 
C

Chris Mullins

Mubashir Khan said:
I am creating an application which would open 100+ sockets. [...]
response should be real time.
This is the reason i have created one thread for each socket.

Ah! Don't do it. You're hurting yourself. Repeat after me: IOCP. IOCP. IOCP.
I remember I/O completion port can be used to create fewer threads using
thread pool, but i would be researching for it and i have got very little
time to complete it.

It's quicker and less bug prone to write it using IOCP in .Net, than it is
to do it using mulitple threads.
My Question, I want better performance and less computer resource usage.
What do u guys suggest ........ VC++ or .Net

..Net. Hands down.

Then run it on x64 and really make it cool...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top