c++ socket connection problem

c++ socket connection problem

Post by pnig » Wed, 21 Jan 2004 04:45:31


Hello, i tried to set up a socket connection with the following code:

#include <afxwin.h>
#include <afxsock.h>


int main()//int argc, char* argv[]
{
CAsyncSocket socket;
socket.Create();
socket.Connect("login.itd.umich.edu", 13);

// you might actually need to use OnReceive() here,
// I'm not sure.
char* Buffer = new char[256];
socket.Receieve(Buffer, 255);
AfxMessageBox(Buffer);

return 0:
}

But there are the following Errormsg...


winnt.h(1092) : error C2146: syntax error : missing ';' before
identifier 'KSPIN_LOCK'

winnt.h(1092) : fatal error C1004: unexpected end of file found
Error executing cl.exe.


...and I have no clue how to fix it. If theres anyone who can help me
please do so :-)
Perhaps with some Documentation...

Very much thx
 
 
 

c++ socket connection problem

Post by Ron Natali » Wed, 21 Jan 2004 04:49:22


These two lines are highly suspect. I suspect you're omitting a required include
file.

However, CAsyncSocket and all the MFC idiocy is off-topic here. Try
micrsoft.public.vc.mfc

 
 
 

c++ socket connection problem

Post by user » Wed, 21 Jan 2004 14:46:03


I think it's this colon right here!!
 
 
 

c++ socket connection problem

Post by red floy » Wed, 21 Jan 2004 17:12:19


As mentioned, this is way OT for c.l.c++, but You have a serious problem.
KSPIN_LOCK comes from the DDK, not from the SDK. Do you have the DDK installed?
Check your environment for INCLUDE_PATH (or whatever the hell VC uses).
 
 
 

c++ socket connection problem

Post by cmad_ » Wed, 21 Jan 2004 23:47:28


I never liked WinSocks... I can't help you with them. If you have a
prob with sockets for linux, catch me somewhere and ask :)

BTW: go to the M$ mfc newsgroup instead...
 
 
 

c++ socket connection problem

Post by cmad_ » Wed, 21 Jan 2004 23:48:59


Well, maybe 1 thing to point out

just leave an empty line at the end of the source file to get rid of the 2nd error.

oh, about the first, you got "return 0:" which should be "return 0;"