// JP opened flex table

Click to See Complete Forum and Search --> : MFC CSocket - uses Winsock 1 or 2 ??


muskad202
March 13th, 2004, 07:38 PM
Hi !!
I wanted to use CSocket in my app, but in afxsock.h, i see that <winsock.h> is included instead of <winsock2.h> .. does this means that CSocket uses Winsock1 ?? is it possible to use Winsock 2?
thanks :)
muskad202

Mathew Joy
March 14th, 2004, 11:43 PM
Well, why do you want to use winsock2?

muskad202
March 15th, 2004, 12:47 AM
why would i want to use winsock1 when i can use the newer winsock2 ?? :)

Mathew Joy
March 15th, 2004, 12:53 AM
Why do you want to use winsock2 when something that you do doesn't even give the efficiency and performance that winsock1 gives?

muskad202
March 15th, 2004, 03:32 AM
meaning ?? winsock2 is worse than winsock1 ?

Mathew Joy
March 15th, 2004, 04:21 AM
Hmmm...was trying to provoke your thought.
Originally posted by muskad202
meaning ?? winsock2 is worse than winsock1 ? No. You have to use it.
Changing #include <winsock.h> to #include <winsock2.h> doesn't make any difference other than able to use the winsock2 specific calls. You may be actually using winsock2 even if you are including only winsock.h. The actual difference is made whether you are linking to wsock32.lib (winsock 1.1) or ws2_32.lib (winsock 2.2). As I pointed out you have to use it. Simply by changing the header files or the lib where you are linked doesn't make any sort of difference in performace, efficiency, whatever. Actually you may loose compatibility with os that supports pure BSD socket calls when changing to ws2 while not using it.

Winsock2 came in for performace. The IO is managed by windows kernal (like overlapped io for instance). All your winsock 1.1 such as basic send/recv calls are directly mapped to the winsock 2.2 counterpart (WSASend/WSARecv).winsock2 is purely downward compatibe with winsock.

So my previous post was saying using csocket doesn't even gives the performace or efficiency the basic blocking winsock 1.1 calls gives. So why are you so interested in changing to winsock2.h .

muskad202
March 15th, 2004, 05:41 AM
ok .. got it .. thanks :)

btw .. i was having a problem using CSocket, .. maybe u can help me with it .. (hopefully :) )
anywayz, the thing is ... at times i get a message like "the application has requested the runtime to terminate it ..." .. it happens when i use the Create call of the CSocket .. any idea how to determine what's going wrong ?

thanks :)
muskad202

Mick
March 15th, 2004, 05:44 AM
Originally posted by muskad202
ok .. got it .. thanks :)

btw .. i was having a problem using CSocket, .. maybe u can help me with it .. (hopefully :) )
anywayz, the thing is ... at times i get a message like "the application has requested the runtime to terminate it ..." .. it happens when i use the Create call of the CSocket .. any idea how to determine what's going wrong ?

thanks :)
muskad202

You should post this question as a seperate thread (it will helps other when the search for solutions) needless to say, yes we have ideas ;) you are crashing obviously and we will give you debugging tips on how to resolve the issue. Post the new thread here in the networking section.

Mathew Joy
March 15th, 2004, 05:48 AM
Originally posted by muskad202
ok .. got it .. thanks :)

btw .. i was having a problem using CSocket, .. maybe u can help me with it .. (hopefully :) ) You don't expect me to use something that I advocate against, do you?;) My suggestion is to use blocking send/recv apis, which is much easier and far less problematic than CSockets.

muskad202
March 15th, 2004, 08:16 AM
hi !!
well, i was initially going to use send/recv/blocking sockets .. but i didn't want to bother with the headache of creating a new thread ...
anywayz, might switch back to that if i can' resolve the CSocket thing...
thanks :)

rashazz
April 7th, 2006, 02:01 PM
how i can make the server listen to multiple requests from several clients simultaneously in vc++

MikeAThon
April 7th, 2006, 03:33 PM
how i can make the server listen to multiple requests from several clients simultaneously in vc++
rashazz,

This thread is more than two years old, and your question is completely unrelated to anything inside it.

Start a new thread.

Mike

//JP added flex table