Que Sockets sockets... a question..
Posted on 1998-08-13
I have a question ( don't we all.. :)) First, the story:
I am trying to use MFC sockets to connect to 2 different servers using TCP/UDP from a MFC application..
The app. originally had a single connection and it worked fine. I integrated the code for the second connection
and the code for both of them are similar...
call WSAStartup(..,.. ) // only called once per application
// the part below appears for each connection ie. twice in different .cpp
m_socket = socket (.....
sockaddr.sin_family = .....
Well, after the integration, there was some network connection error...
I solved it !!!!! But I had to add (A) #include <afxsock.h> in stdafx.h and had to comment out this line:
(B) if (! AfxSocketInit()) .... in MyApp::InitInstance ( which was part of my 2nd connection code example )
MY question is :
1. Why did the 1 connection (b4 changes) version work fine when I didn't add (A) and
2. Why did I have to comment out the code as in (B)?
That's it... I just want to know the reasons...