안녕하세요 지금 졸업준비중인 대학원생입니당
논문실험때문에 TCP 소켓 프로그래밍 (고급? 수준인가..) 중인데 해결못한 부분이 있어서 질문올립니다 ㅠㅠㅠㅠ
다름이 아니고 제가 Bandwidth estimation 을 위해서 소켓 프로그래밍 중에 TCP 정보를 얻어오는 방법을 구글링으로 찾아보니,
getsockopt(sockfd, IPPROTO_TCP, TCP_INFO, (void*)&info, &len)
을 쓰면 된다고 하더군요. 여기서 info는 struct tcp_info 형태의 구조체입니다.
struct tcp_info {
__u8 tcpi_state;
__u8 tcpi_ca_state;
__u8 tcpi_retransmits;
__u8 tcpi_probes;
__u8 tcpi_backoff;
__u8 tcpi_options;
__u8 tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
__u32 tcpi_rto;
__u32 tcpi_ato;
__u32 tcpi_snd_mss;
__u32 tcpi_rcv_mss;
__u32 tcpi_unacked;
__u32 tcpi_sacked;
__u32 tcpi_lost;
__u32 tcpi_retrans;
__u32 tcpi_fackets;
/* Times. */
__u32 tcpi_last_data_sent;
__u32 tcpi_last_ack_sent; /* Not remembered, sorry. */
__u32 tcpi_last_data_recv;
__u32 tcpi_last_ack_recv;
/* Metrics. */
__u32 tcpi_pmtu;
__u32 tcpi_rcv_ssthresh;
__u32 tcpi_rtt;
__u32 tcpi_rttvar;
__u32 tcpi_snd_ssthresh;
__u32 tcpi_snd_cwnd;
__u32 tcpi_advmss;
__u32 tcpi_reordering;
__u32 tcpi_rcv_rtt;
__u32 tcpi_rcv_space;
__u32 tcpi_total_retrans;
};
지금 제가 여기서 알아내고자 하는게 RTT, window size 값인데, info.tcpi_rcv_space, info.tcpi_rcv_mss, tcpi_rcv_rtt 값으로 구할 수 있는걸 확인했습니당..
문제는 tcpi_snd_wscale, tcpi_rcv_wscale 값인데, 이 값을 어떻게 써야될지를 모르겠습니다.
구글로 검색하면 대부분 tcp.h 헤더파일 내용이거나 값을 대입하는 구문이고... 어떻게 찾아낸것중 하나가
(현재 include/linux/tcp.h 파일에는 아래 주석이 없습니다)
/* RFC1323 send shift value. */, /* RFC1323 recv shift value. */
근데 실상 어떻게 쓰는지를 모르니.... 엉엉.... 이것때문에 주말내내 헤메고있습니다
전문가님들 tcpi_snd_wscale, tcpi_rcv_wscale 값을 어떻게 써야되는지 알려주세요 ㅠㅠ