hey,
i'm very new to networking in Java and I'm trying to implement
a datagram client and server. My problem atm is writing a timer for the
client in java so that if the server does not respond within a certain time period then the client's request is resent. Could someone please show me how i would do this

, i have looked at the Timer class but my experimentation with it failed.
This was my experiment, out of curiousity could u tell me why "hello" was
not printed out.
|
Code:
|
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
public class Timers {
public static void main(String[] args){
int delay = 1000; //milliseconds
ActionListener taskPerformer = new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
System.out.println("hello");
}
};
new Timer(delay, taskPerformer).start();
}
} |
Thanx