Timeout

This is more of a java question than a question about smack. Hope that someone can still give me some pointers.

My java application invites someone to a chat and then waits for him to enter this chat (with a listener/collector that checks the presence packets).

My problem is that I only want the app to wait for a certain amount of time (for example 30secs) for this person to enter the chat room.

I can’'t seem to figure out the best way to accomplish this.

Any help would be very much appreciated.

Gordon,

How about creating a new thread that waits on a packet collector for up to 30 seconds (the packet collector method that takes a timeout value). If it never gets a “join” packet from the other user, it will return null at the end of 30 seconds and then you can take some other action.

Regards,

Matt