• Advertisement

Archived

This topic is now archived and is closed to further replies.

need some help with a "timeout" function

This topic is 5498 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Java. Can someone give me some tips on how to construct a timeout function. Lets say a object(sender) sends a message to another object(receiver). How could I construct a timeout function so that if the sender does not receive a reply back in a certain amount of time "it" moves on. Im thinking I need to use a thread somehow? Any help would be appreciated. no code please.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
I dont think you need to use threads.

how about:


while(loop)
{
check(); //check if there is a reply

if(time()) //if too much time has passed by
break; //stop the loop
}

Is there a reason you cant do something like that?
instead of break, you might do something to handle the tomeout, if it would not be proper to just continue the program like nothing happened.

Share this post


Link to post
Share on other sites

  • Advertisement