tfPingGetStatistics
Table of Contents >> Application Reference >> PING API
| #include <trsocket.h> |
| int tfPingGetStatistics | ( |
| int socketDescriptor, | |
| ttPingInfoPtr pingInfoPtr | |
| ); |
Function Description
This function gets Ping statistics in the ttPingInfo structure that pingInfoPtr points to. socketDescriptor should match the socket descriptor returned by a call to tfPingOpenStart(). pingInfoPtr must point to a ttPingInfo structure allocated by the user.
Parameters
- socketDescriptor
- The socket descriptor as returned by a previous call to tfPingOpenStart().
- pingInfoPtr
- A pointer to an empty structure where the results of the PING connection will be copied upon successful completion of the call.
#define trsocket.h /* * Ping info Structure where statistics on the PING connection are kept. */ typedef struct tsPingInfo { /* Peer socket address */ struct sockaddr_storage pgiPeerSockAddr; /* Last round trip time computed */ ttUser32Bit pgiLastRtt; /* maximum round trip time */ ttUser32Bit pgiMaxRtt; /* minimum round trip time */ ttUser32Bit pgiMinRtt; /* average round trip time */ ttUser32Bit pgiAvgRtt; /* sum of all round trip time received so far (to compute average) */ ttUser32Bit pgiSumRtt; /* number of ping transmitted packets */ ttUser32Bit pgiTransmitted; /* * number of received echo replies packets (not including duplicated * packets) */ ttUser32Bit pgiReceived; /* Number of duplicated ping echo replies packets */ ttUser32Bit pgiDuplicated; /* Send Error code if any that occured */ int pgiSendErrorCode; /* Recv CB Error code if any that occured */ int pgiRecvErrorCode; } ttPingInfo; /* Pointer to a ping info structure */ typedef ttPingInfo TM_FAR * ttPingInfoPtr;
Returns
- > 0
- New socket descriptor.
- TM_SOCKET_ERROR
- Failure.
| TM_SOCKET_ERROR means that this socket call has failed and the errorCode has been set on the socket itself.
To retrieve the socket error the user must call tfGetSocketError(socketDescriptor). |
Possible socket errors
- TM_EBADF
- The socket descriptor is invalid.
- TM_EINVAL
- One of the following:
- pingInfoPtr is 0.
- socketDescriptor was not opened with tfPingOpenStart().