c++ socket connection problem

P

pnigl

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
 
R

Ron Natalie

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

#include <afxwin.h>
#include <afxsock.h>
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
 
U

user

pnigl said:
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:
I think it's this colon right here!!
 
R

red floyd

pnigl said:
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:

I think it's this colon right here!!
}

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.

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

Chris Mantoulidis

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

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

Chris Mantoulidis

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

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;"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,416
Latest member
LionelQ387

Latest Threads

Top