Would calling RIOReceive() on a closed socket potentially cause a crash?

형진 김 20 Reputation points
2024-04-15T02:06:23.07+00:00

Hello, I would like to inquire about a crash that occurred when calling the RIOReceive() function.

Please understand that the sentences may be strange because I used a translator.

What happens is that thread A performs closesocket(sock) on the previously connected socket sock,

When thread B attempts RIOReceive(rq, ...) for RIO_RQ rq connected to the corresponding socket,

Occasionally, mswsock.dll crashes during execution of the RIOReceive() function.

Additionally, in MSDN's LPFN_RIOCREATEREQUESTQUEUE callback function document,

'As request queues are closed by closing the sockets using the closesocket function, those slots will be freed up for use by other sockets.'

There is a sentence, and I would like to also inquire about what slots refers to here.

Thank you for your attention to this matter.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,425 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,535 questions
{count} votes

Accepted answer
  1. Jeanine Zhang-MSFT 9,181 Reputation points Microsoft Vendor
    2024-04-15T08:12:58.88+00:00

    Whether you call closesocket() first and then call RIOReceive()?

    When you call the closesocket function, the request queues (RIO_RQ structs) are closed.

    An application must obtain a RIO_RQ for a Winsock socket, and then the application can use the RIOSend, RIOSendEx, RIOReceive, or RIOReceiveEx functions.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful