Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello


I have developed a Server Program which accepts multiple clients. I have used infinite while loop for accepting connections from client . But when i start the program the window is not responding. My code is

C++
while(true)
{
    csock = (int*)malloc(sizeof(int));
    if((*csock = accept( hsock, (SOCKADDR*)&sadr, &addr_size))!= INVALID_SOCKET )
    {			
	CreateThread(0,0,&SocketHandler, (void*)csock ,0,0);
    }
}


I am just a beginner in VC++ . Please help me out to solve this.
Posted
Comments
Resmi Anna 27-Mar-12 6:40am    
did you try debugging?Is your code blocking at accept() function. Please post the code how you created the socket. Have you created a nonblocking socket?

1 solution

What errors the Express Editior show?
 
Share this answer
 
Comments
Geo Jackson 27-Mar-12 1:36am    
No error on compilation, I cant click the window, the flow waits in the Accept function.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900