redoctober
Programmer
Hi there,
I have to add network functionaly to the existing project which was originally created without Windows Sockets support. I've programmed networking before, but it seems that that some settings or something being turned on when you create project with win socket support. I'm having hard time figuring out what i have to do with the project so it would start understanding CSockets. What i've done so far to add CSocket is:
added line #include <afxsock.h> to Stdafx.h file
and
added Windows sockets component from Project->Add to Project->Components and Controls->Windows sockets
But it still seems to be not enough. Program compiles, but when i run it, it crashes when i try to create CSocketFile (line 3):
1. m_CSoc = new CClientSocket();
2. m_CSoc->Connect(myip, myport);
3. file = new CSocketFile(m_CSoc);
4. m_CSoc->arIn = new CArchive(file,CArchive::load);
5. m_CSoc->arOut = new CArchive(file,CArchive::store);
Exact same code worked fine in another program.
Can anyone see if i'm missing any initialization?
thanks for any help.
I have to add network functionaly to the existing project which was originally created without Windows Sockets support. I've programmed networking before, but it seems that that some settings or something being turned on when you create project with win socket support. I'm having hard time figuring out what i have to do with the project so it would start understanding CSockets. What i've done so far to add CSocket is:
added line #include <afxsock.h> to Stdafx.h file
and
added Windows sockets component from Project->Add to Project->Components and Controls->Windows sockets
But it still seems to be not enough. Program compiles, but when i run it, it crashes when i try to create CSocketFile (line 3):
1. m_CSoc = new CClientSocket();
2. m_CSoc->Connect(myip, myport);
3. file = new CSocketFile(m_CSoc);
4. m_CSoc->arIn = new CArchive(file,CArchive::load);
5. m_CSoc->arOut = new CArchive(file,CArchive::store);
Exact same code worked fine in another program.
Can anyone see if i'm missing any initialization?
thanks for any help.