I have a server application that opens a socket and listens for a connection. In the application, I have a separate thread that creates a socket, binds it and calls the listen and accept functions on it.
When the application closes, I call closesocket on the created socket, then I wait until the socket stream closes. However, if a thread waits in an accept function, the thread never terminates.
I thought the accept function would return after calling cloasesocket. Is that the right thought? If so, why does the accept function not return? Is there any other way to get the accept function to return?
source share