An encapsulation of Apple's SimplePing, support RTT and packetsloss result.
- Apple's SimplePing has update to support IPv6 network.
- RTT and packetsloss.
- Ping timeout set to 1.5s.
// ADD
// Send Timeout:1.5s
CFSocketNativeHandle sock = CFSocketGetNative(self->_socket);
struct timeval tv;
tv.tv_sec = 1;
tv.tv_usec = 500000;
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (void *)&tv, sizeof(tv));
// end Add
bytesSent = sendto(
sock,
packet.bytes,
packet.length,
0,
self.hostAddress.bytes,
(socklen_t) self.hostAddress.length
);
- import "SRPingHelper.h"
- Implement SRPingHelperDelegate delegate method.
- See demo.
Drag the floder SRPingHepler to your project.
Import the main header file:#import "SRPingHepler.h"
If you have any question, send email to qqingweihao@163.com