Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit04be799

Browse files
megacctpennam
authored andcommitted
SocketHelpers: expose ping timeout
1 parent9f0337f commit04be799

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

‎libraries/SocketWrapper/src/SocketHelpers.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,22 @@ arduino::IPAddress arduino::MbedSocketClass::dnsIP(int n) {
7575
returnipAddressFromSocketAddress(ip);
7676
}
7777

78-
intarduino::MbedSocketClass::ping(constchar *hostname,uint8_t ttl)
78+
intarduino::MbedSocketClass::ping(constchar *hostname,uint8_t ttl,uint32_t timeout)
7979
{
8080
SocketAddress socketAddress;
8181
gethostbyname(getNetwork(),hostname, &socketAddress);
82-
returnping(socketAddress, ttl);
82+
returnping(socketAddress, ttl, timeout);
8383
}
8484

85-
intarduino::MbedSocketClass::ping(const String &hostname,uint8_t ttl)
85+
intarduino::MbedSocketClass::ping(const String &hostname,uint8_t ttl,uint32_t timeout)
8686
{
87-
returnping(hostname.c_str(), ttl);
87+
returnping(hostname.c_str(), ttl, timeout);
8888
}
8989

90-
intarduino::MbedSocketClass::ping(IPAddress host,uint8_t ttl)
90+
intarduino::MbedSocketClass::ping(IPAddress host,uint8_t ttl,uint32_t timeout)
9191
{
9292
SocketAddress socketAddress =socketAddressFromIpAddress(host,0);
93-
returnping(socketAddress, ttl);
93+
returnping(socketAddress, ttl, timeout);
9494
}
9595

9696
voidarduino::MbedSocketClass::config(arduino::IPAddress local_ip) {

‎libraries/SocketWrapper/src/SocketHelpers.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ class MbedSocketClass {
118118
*
119119
* return: RTT in milliseconds or -1 on error
120120
*/
121-
intping(constchar* hostname,uint8_t ttl =255);
122-
intping(const String &hostname,uint8_t ttl =255);
123-
intping(IPAddress host,uint8_t ttl =255);
121+
intping(constchar* hostname,uint8_t ttl =255,uint32_t timeout =5000);
122+
intping(const String &hostname,uint8_t ttl =255,uint32_t timeout =5000);
123+
intping(IPAddress host,uint8_t ttl =255,uint32_t timeout =5000);
124124

125125
/*
126126
* Download a file from an HTTP endpoint and save it in the provided `target` location on the fs
@@ -185,7 +185,7 @@ class MbedSocketClass {
185185

186186
voidbody_callback(constchar* data,uint32_t data_len);
187187

188-
intping(SocketAddress &socketAddress,uint8_t ttl,uint32_t timeout =5000);
188+
intping(SocketAddress &socketAddress,uint8_t ttl,uint32_t timeout);
189189
static arduino::IPAddressipAddressFromSocketAddress(SocketAddress socketAddress);
190190
static SocketAddresssocketAddressFromIpAddress(arduino::IPAddress ip,uint16_t port);
191191
staticnsapi_error_tgethostbyname(NetworkInterface* interface,constchar* aHostname, SocketAddress* socketAddress);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp