Bonjour a vous ,
j'ai des résultat d'un programme qui ping chaque 15 min en affichant l'adresse ip , l'état du ping , data et heur maintenant j'aimerai bien savoir comment je peut enregistré ces données du ping dans un fichier csv

c'est comme ci un fichier d'historique des ping car ce ping il se répète chaque 15 min.

merci d'avance



code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package ping;
 
	import java.io.IOException;
 
	import java.net.InetAddress;
	import java.net.UnknownHostException;
	import java.text.DateFormatSymbols;
	import java.text.SimpleDateFormat;
	import java.util.Date;
	import java.util.Timer;
	import java.util.TimerTask;
 
	public class pingBiodec {
 
 
	        public static void main(String[] args) throws UnknownHostException, IOException {
 
	            int MINUTES = 15; // The delay in minutes
	            Timer timer = new Timer();
	             timer.schedule(new TimerTask() {
	                @Override
	                public void run() { // Function runs every MINUTES minutes.
	                    // Run the code you want here
 
 
	                    Date aujourdhui = new Date();
	                    DateFormatSymbols monDFS = new DateFormatSymbols();
	                    String[] joursCourts = new String[] {
	                        "",      
	                        "lundi",
	                        "Mardi",
	                        "mercredi",
	                        "jeudi",     
	                        "vendredi",
	                        "samedi",
	                        "dimanche" };
 
 
	              monDFS.setShortWeekdays(joursCourts);
	              SimpleDateFormat dateFormat = new SimpleDateFormat(
	              "EEEEEEEE dd MMM yyyy HH:mm:ss",  
	              monDFS);
	              System.out.println(dateFormat.format(aujourdhui));
 
	                    InetAddress inet = null;
 
	                    for(int i=1;i<=166;i++){
	                  try {
 
 
	                        inet = InetAddress.getByAddress(new byte[] { (byte) 170, (byte) 0, 0,(byte)i});
 
 
 
	                    } catch (UnknownHostException e) {e.printStackTrace();} 
	                  System.out.println("Sending Ping Request to " + inet);
	                    try {
	                        System.out.println(inet.isReachable(5000) ? "OK" : "ERR" );
 
	                    } catch (IOException e) {
 
	                        e.printStackTrace();
	                    }
 
	                    }
 
	                }
 
 
 
	                } , 0, 1000 * 60 * MINUTES);
	                // 1000 milliseconds in a second * 60 per minute * the MINUTES variable. 
 
 
 
 
	}}