powered by Jive Software

How to run a PacketCollector for a given time period then return?

Hi All

I need to wait for a given period - say 30 seconds - for clients to respond to a message request. I then want to return the results. How should I go about doing this? It feels like a PacketCollector is the right tool, but I don’t know how to be using it. I have seen the brief sample that shows creation with a PacketFilter, that’s not much use, I need the threading / blocking pattern that would go around it. Suggestions / code examples much appreciated.

SyncPacketSend.getReply(connection, requestPacket, timeout);

This is for making synchronous requests with a settable timeout. You will need the version from trunk though as it is post 3.1.

If that is not an option, the code for that class is here, so you can write your own.