@@ -14,7 +14,7 @@ public class PingProbe : IProbe<PingResult>
1414 {
1515 private readonly string _address ;
1616 private readonly string Data = "0000000000000000000000000000000" ;
17- private readonly int Timeout = 120 ;
17+ private readonly int _timeout = 120 ;
1818
1919 /// <summary>
2020 /// Ping probe constructor
@@ -25,6 +25,17 @@ public PingProbe(string hostName)
2525 _address = hostName ;
2626 }
2727
28+ /// <summary>
29+ /// Ping probe constructor
30+ /// </summary>
31+ /// <param name="hostName"></param>
32+ /// <param name="timeout"></param>
33+ public PingProbe ( string hostName , int timeout )
34+ {
35+ _address = hostName ;
36+ _timeout = timeout ;
37+ }
38+
2839 /// <summary>
2940 /// Ping probe constructor
3041 /// </summary>
@@ -34,6 +45,17 @@ public PingProbe(IPAddress ipAddress)
3445 _address = ipAddress . ToString ( ) ;
3546 }
3647
48+ /// <summary>
49+ /// Ping probe constructor
50+ /// </summary>
51+ /// <param name="ipAddress"></param>
52+ /// <param name="timeout"></param>
53+ public PingProbe ( IPAddress ipAddress , int timeout )
54+ {
55+ _address = ipAddress . ToString ( ) ;
56+ _timeout = timeout ;
57+ }
58+
3759 /// <summary>
3860 /// Execute ping probe
3961 /// </summary>
@@ -48,7 +70,7 @@ public async Task<PingResult> Execute()
4870 } ;
4971
5072 byte [ ] buffer = Encoding . ASCII . GetBytes ( Data ) ;
51- PingReply reply = await pingSender . SendPingAsync ( _address , Timeout , buffer , options ) ;
73+ PingReply reply = await pingSender . SendPingAsync ( _address , _timeout , buffer , options ) ;
5274
5375 return new PingResult ( reply . Status , reply . Address . ToString ( ) , reply . RoundtripTime , reply . Options ? . Ttl , reply . Buffer . Length ) ;
5476 }
0 commit comments