從應用層程式取得傳輸層 TCP 資訊
#include <netinet/tcp.h>
50 #define TCP_INFO 11 /* Information about this connection. */ 199 struct tcp_info
200 {
201 u_int8_t tcpi_state;
202 u_int8_t tcpi_ca_state;
203 u_int8_t tcpi_retransmits;
204 u_int8_t tcpi_probes;
205 u_int8_t tcpi_backoff;
206 u_int8_t tcpi_options;
207 u_int8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
208
209 u_int32_t tcpi_rto;
210 u_int32_t tcpi_ato;
211 u_int32_t tcpi_snd_mss;
212 u_int32_t tcpi_rcv_mss;
213
214 u_int32_t tcpi_unacked;
215 u_int32_t tcpi_sacked;
216 u_int32_t tcpi_lost;
217 u_int32_t tcpi_retrans;
218 u_int32_t tcpi_fackets;
219
220 /* Times. */
221 u_int32_t tcpi_last_data_sent;
222 u_int32_t tcpi_last_ack_sent; /* Not remembered, sorry. */
223 u_int32_t tcpi_last_data_recv;
224 u_int32_t tcpi_last_ack_recv;
225
226 /* Metrics. */
227 u_int32_t tcpi_pmtu;
228 u_int32_t tcpi_rcv_ssthresh;
229 u_int32_t tcpi_rtt;
230 u_int32_t tcpi_rttvar;
231 u_int32_t tcpi_snd_ssthresh;
232 u_int32_t tcpi_snd_cwnd;
233 u_int32_t tcpi_advmss;
234 u_int32_t tcpi_reordering;
235
236 u_int32_t tcpi_rcv_rtt;
237 u_int32_t tcpi_rcv_space;
238
239 u_int32_t tcpi_total_retrans;
240 }; Last updated