Int nRow=m_listMessage. GetItemCount ();
M_listMessage. InsertItem (nRow, _T (" click on "start" button!" ));//insert row
NRow=m_listMessage. GetItemCount ();
If (nRow & gt; 0)
M_listMessage. EnsureVisible (nRow - 1, FALSE);
Sockaddr_in remoteAddr;
Int nAddrlen=sizeof (remoteAddr);
While (1) {
The SOCKET * ClientSocket=new SOCKET;
ClientSocket=(SOCKET *) malloc (sizeof (SOCKET));
* ClientSocket=accept (slisten, (SOCKADDR *) & amp; RemoteAddr, & amp; NAddrlen);//0, 0);
CreateThread (NULL, 0, & amp; ServerThread, ClientSocket, 0, NULL);
}//while
Closesocket (slisten);
WSACleanup ();
return;//(0);
Step to the accept () that will be stuck, point break, suggesting the tips above "process may have a deadlock (or is not running any user-mode code), all threads have been stopped,"
CodePudding user response:
Accept it isn't in the main interface thread, it is also open a threadCodePudding user response:
You want to go into the thread, listening is a blocking process, in the main program of the resistance of the main program is deadCodePudding user response:
Block patterns are blocking the accept function, blocked the message loop, want to open a thread to receiveCodePudding user response:
a non-blocking connect () and the accept ()CodePudding user response:
You haven't understood the socket connection, the order of the first reading, then writing code.