Treating overlapped I/O WSARecvFrom with error code 10054 RRS feed

  • 질문

  • WSARecvFrom returns 10054 or its completion signal gives 10054 error code, if the remote UDP endpoint is already closed. For ignoring this error code, WSAIoctl with SIO_UDP_CONNRESET works.

    Yes, I know this. However, I am not sure about these below:

    [Question 1]
    What is the recommended way if 10054 is returned from WSARecvFrom() in overlapped I/O way? As far as I've tested, SOMETIMES occurs, not EVERY TIME nor NEVER. This makes me confused, because what routine should I write for issuing and completing UDP receive process for this case. Assuming that the signal NEVER occurs, I think calling WSARecvFrom again if the previous WSARecvFrom return 10054. Assuming EVERY TIME, treating 10054 just like other completion type is ok. Assuming SOMETIMES, I should write some tricky routine which tries WSARecvFrom again if there's no completion singal is incoming for some seconds. What a dirty method!

    I use that overlapped I/O WSARecvFrom with a I/O Completion Port.

    [Question 2]
    Disabling 10054 with SIO_UDP_CONNRESET seems to be a workaround for backward compatibility. I.E unrecommended way for writing a new application. Is that right?
    I am not sure the correct way of treating 10054 with overlapped I/O, so I write my code to disable it.

    Please reply. Thanks in advance.

    2010년 2월 22일 월요일 오전 5:39