Jump to content
  • Advertisement

Archived

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

jen6677

need some help with a "timeout" function

This topic is 5680 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!