Winsock and MFC
-
I have downloaded and used:-
simples.c - Simple TCP/UDP server using Winsock 1.1
Now I have built and run a Client and Server Win32 Console application using this sample using my data structure. But problem with using the same code in a worker thread of a MFC application. The following line causes problems:-
char *interface= NULL;
It generates the following errors:-c:\ExampleDlg.cpp(214): error C2332: 'struct' : missing tag name c:\ExampleDlg.cpp(214): error C2011: '__unnamed' : 'enum' type redefinition c:\ExampleDlg.cpp(214): warning C4518: '__unnamed ' : storage-class or type specifier(s) unexpected here; ignored c:\ExampleDlg.cpp(214): error C2059: syntax error : '='
Whats the solution to this problem please anyone? -
I have downloaded and used:-
simples.c - Simple TCP/UDP server using Winsock 1.1
Now I have built and run a Client and Server Win32 Console application using this sample using my data structure. But problem with using the same code in a worker thread of a MFC application. The following line causes problems:-
char *interface= NULL;
It generates the following errors:-c:\ExampleDlg.cpp(214): error C2332: 'struct' : missing tag name c:\ExampleDlg.cpp(214): error C2011: '__unnamed' : 'enum' type redefinition c:\ExampleDlg.cpp(214): warning C4518: '__unnamed ' : storage-class or type specifier(s) unexpected here; ignored c:\ExampleDlg.cpp(214): error C2059: syntax error : '='
Whats the solution to this problem please anyone?May be the download stuff itself got some bugs in !!! May I know what you trying to do?
-
May be the download stuff itself got some bugs in !!! May I know what you trying to do?
-
Just want to receive a packet of data from another application on another PC. So I will be the Server. The Microsoft sample works fine (as a console application), but its when you try and use the code in an MFC application get these errors.
I use NDK from the link below, http://www.codeproject.com/internet/ndk.asp?df=100&forumid=1156&exp=0&select=756975 it's just nice;P
-
Just want to receive a packet of data from another application on another PC. So I will be the Server. The Microsoft sample works fine (as a console application), but its when you try and use the code in an MFC application get these errors.
Try looking at CAsyncSocket or CSocket. Also it would be better to make your thread a UI thread so that it can receive events on the socket. Also if you do it that way it is better to create the socket in each thread. Take a look at Joseph Newcomer's website about threads and sockets. [^] Tom Wright tawright915@yahoo.com