Link to home
Start Free TrialLog in
Avatar of staggart
staggart

asked on

MFC, Winsock 1 & 2 and ping

I have an MFC app.  I need it to be able to ping a remote machine.  I have the sample ping.c code from the MSDN but it uses winsock2.  But, MFC uses winsock 1.1 (I believe).  How do I get MFC to work with winsock2 or how to I get a ping function to work with winsock 1.1 (the ping sample uses WSASocket() which is not available under 1.1).  Is there sample ping code that runs under winsock 1.1 or a way to convince MFC to use winsock 2?

Thanks,  Scott.
Avatar of jhance
jhance

MFC is not bound to a particular version of WINSOCK.  That depends on the WINSOCK library you have installed on your system.  Win98 and NT4.0 use WINSOCK 2 by default.  Win95 can have either.  It shipped with WINSOCK 1 but you can download and install the update.
Avatar of staggart

ASKER

That may be, but when you compile an MFC app, you end up with the winsock.h file which cleary states it is the 1.1 version.  Also, the default link ends up with the 1.1 library which means you can't get to some of the 2.0 functions.  Therefore, while 2.0 may be installed in your system, you can't easily get to it from MFC.  My question clearly stated that I want access to the 2.0 library from MFC.  That's what I need.  If you know the "tricks" to get MFC to play the 2.0 games (bothg compileing and linking issues resolved), I will award youthe points.

Scott
ASKER CERTIFIED SOLUTION
Avatar of jhance
jhance

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial