1

私が達成したいのはこれであるため、ウィンドウソケットの内部バッファーをクリーンアップする方法があるかどうか疑問に思っています

while(1){
 for(i=0;i<10;i++){
    sendto(...) //send 10 UDP datagrams
 }
 for(i=0;i<10;i++){
    recvfrom (Socket, RecBuf, MAX_PKT_SIZE, 0,
                   (SOCKADDR*) NULL, NULL);
    int Status = ProcessBuffer(RecBuf);
    if (Status == SomeCondition)
        MagicalSocketCleanUP(Socket); //clean up the rest of stuff in the socket, so that it doesn't effect the reading for next iteration of the outer while loop
        break; //occasionally the the receive loop needs to terminate before finishing off all 10 iteration
 }
} 

それで、ソケットに残っているものをクリーンアップして、次の読み取りに影響を与えないようにする機能はありますか?ありがとうございました

4

1 に答える 1