Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6884253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:29:03+00:00 2026-05-27T05:29:03+00:00

The basic code sequence I’m interesting for is (pseudocode) sendto(some host); // host may

  • 0

The basic code sequence I’m interesting for is (pseudocode)

sendto(some host); // host may be unreachable for now which is normal
...
if(select(readfs, timeout)) // there are some data to read
  recvfrom();

Since Win2000, ICMP packet, which is sent back after sending UDP datagram to unreachable port, triggers select, after that recvfrom fails with WSAECONNRESET. Such behaviour isn’t desirable for me, because I want select to finish with timeout in this case (there are no data to read). On Windows this can be solved with WSAIoctl SIO_UDP_CONNRESET ( http://support.microsoft.com/kb/263823 ).

My questions are:

  1. Is SIO_UDP_CONNRESET the best way in this situation?
  2. Are there some other methods to ignore ICMP for “select” or to filter it for recvfrom (maybe, ignoring WSAECONNRESET error on Windows treating it like timeout, can this error be triggered in some other case)?
  3. Are there similar issues on Linux and Unix (Solaris, OpenBSD)?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:29:04+00:00Added an answer on May 27, 2026 at 5:29 am

    select()‘s readfds set really just reports that a read() on the socket won’t block — it doesn’t promise anything about whether or not there is actual data available to read.

    I don’t know what specifically you’re trying to accomplish with the two-second timeout rather than just sleeping forever — nor why you can’t just add an if block to check for WSAECONNRESET from recvfrom() — but it feels like you’ve got an overly-complicated design if it doesn’t handle this case well.

    The select_tut(2) manpage on many Linux systems has some guidelines for properly using select(). Here’s several rules that seem most apropos to your situation:

       1.  You should always try to use select() without a timeout.
           Your program should have nothing to do if there is no
           data available.  Code that depends on timeouts is not
           usually portable and is difficult to debug.
    
       ...
    
       3.  No file descriptor must be added to any set if you do not
           intend to check its result after the select() call, and
           respond appropriately.  See next rule.
    
       4.  After select() returns, all file descriptors in all sets
           should be checked to see if they are ready.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently, I have some basic code to play a simple tone whenever a button
I have some basic PHP code: $raceramps56[short] = My Test Product; $leftMenu = '<div
I have some very basic semaphore code that works great on Linux, but cannot
I am building some basic HTML code for a CMS. One of the page-related
This is a basic code which I use to pull info from my affiliate
I have some basic code here. It just creates a div element to a
I have set up an application and used some of the basic code from
Here is some basic code and its output. I really can't say anything more
I have the basic code to rewrite a subdomain to another page. But how
I'm looking for a basic code samples of how to upload files to server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.