Click here to Skip to main content
16,017,297 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to copy folders? Pin
22491714-Apr-05 19:12
22491714-Apr-05 19:12 
Generalauto start program Pin
_tasleem14-Apr-05 10:42
_tasleem14-Apr-05 10:42 
GeneralRe: auto start program Pin
mark novak14-Apr-05 11:41
mark novak14-Apr-05 11:41 
GeneralRe: auto start program Pin
22491714-Apr-05 17:49
22491714-Apr-05 17:49 
GeneralAutoscroll a listbox Pin
Anonymous14-Apr-05 10:15
Anonymous14-Apr-05 10:15 
GeneralRe: Autoscroll a listbox Pin
Anonymous14-Apr-05 10:23
Anonymous14-Apr-05 10:23 
GeneralCComboBox without Border Pin
tobi7814-Apr-05 9:22
tobi7814-Apr-05 9:22 
GeneralThread Creation / Server Pin
brilliant10114-Apr-05 8:59
brilliant10114-Apr-05 8:59 
1)I converted the MFC TCP server into non mfc TCP server using winsock.h.
It complies and runs but it does not performs efficiently as the server thread is not created properly in the non mfc statment of _beginthread and CreateThread
Plz modify the code so that it runs smoothly thanks
2) what i have to do to make UDP server?
3) how can i change it into mutithreaded server( that accpets connections from many threads?)

#include process.h
#include windows.h
#include iostream.h
#include conio.h
#include winsock2.h
/* _beginthread, _endthread */

#include stddef.h
#include stdlib.h

unsigned int ServerThread(LPVOID pParam);

int main(int argc, char* argv[])
{
HANDLE hThread;
unsigned long iID;
cout<<"!!hello world!!\n";
LPVOID var=0;
//unsigned int block=0;
//block=ServerThread(var); //Call to the function
// _beginthreadex( ServerThread, 0, NULL );

hThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE )ServerThread,NULL,0,&iID);

//_beginthread(ServerThread, 0, NULL );
// hThread = (HANDLE)_beginthreadex( NULL, 0, &ServerThread, NULL, 0,
// &iID );

cout<<"\n\nyahoo";
// while(getch()!=27);
// getch();

return 0;
}



unsigned int ServerThread(LPVOID pParam)
{

cout<<"Hello from thread";

SOCKET server; //Socket is unsigned int
WSADATA wsaData;
sockaddr_in local; // Structure variable

int wsaret=WSAStartup(0x101,&wsaData); //Initialization

if(wsaret!=0)
{
return 0;
}
GeneralHelp! Many questions about using CString Pin
tttyip14-Apr-05 6:48
tttyip14-Apr-05 6:48 
GeneralRe: Help! Many questions about using CString Pin
David Crow14-Apr-05 7:59
David Crow14-Apr-05 7:59 
GeneralRe: Help! Many questions about using CString Pin
tttyip15-Apr-05 4:58
tttyip15-Apr-05 4:58 
GeneralDialog Insertion Help Pin
BritishEmpire14-Apr-05 5:53
BritishEmpire14-Apr-05 5:53 
GeneralRe: Dialog Insertion Help Pin
mark novak14-Apr-05 11:22
mark novak14-Apr-05 11:22 
GeneralI need help on this problem. Pin
daAnswer14-Apr-05 5:50
daAnswer14-Apr-05 5:50 
GeneralRe: I need help on this problem. Pin
Bob Flynn14-Apr-05 6:27
Bob Flynn14-Apr-05 6:27 
GeneralRe: I need help on this problem. Pin
Anonymous14-Apr-05 15:27
Anonymous14-Apr-05 15:27 
QuestionCookies in MFC? Pin
soundman3214-Apr-05 5:26
soundman3214-Apr-05 5:26 
AnswerRe: Cookies in MFC? Pin
David Crow14-Apr-05 7:47
David Crow14-Apr-05 7:47 
GeneralRe: Cookies in MFC? Pin
soundman3214-Apr-05 21:38
soundman3214-Apr-05 21:38 
QuestionGDI+ bug? Pin
ZHANG, Lei14-Apr-05 5:00
ZHANG, Lei14-Apr-05 5:00 
AnswerRe: GDI+ bug? Pin
PJ Arends14-Apr-05 11:03
professionalPJ Arends14-Apr-05 11:03 
GeneralDisplaying text in a textbox from one form to another form Pin
underb@asd20.org14-Apr-05 4:56
underb@asd20.org14-Apr-05 4:56 
GeneralRe: Displaying text in a textbox from one form to another form Pin
Joel Holdsworth14-Apr-05 12:44
Joel Holdsworth14-Apr-05 12:44 
General[Message Deleted] Pin
Adeel Chaudhry14-Apr-05 4:10
Adeel Chaudhry14-Apr-05 4:10 
GeneralRe: i want two header files of VC6!!! Pin
David Crow14-Apr-05 4:45
David Crow14-Apr-05 4:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.