안녕하세요..
윈도우만 사용하다.. 리눅스에서 테스트하려니.. 어렵네요... ㅠㅠ
다름이 아니라..
리눅스에서 tcp의 congestion window 값을 얻어오려고 합니다.
커널을 손대지 않고 하는 얻어올수 있는 방법이 없을까요;;;
도움 부탁드립니다...
편안한 밤 되세요~ ^^
getsockopt에 TCP_INFO를 사용하시면 됩니다. 리눅스 맨페이지 tcp(7)을 참고하세요. 다음은 예제 코드입니다.
#include <stdio.h> #include <sys/socket.h> #include <netinet/in.h> #include <netinet/tcp.h> int main() { int len; int sock; struct tcp_info info; sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); len = sizeof(info); getsockopt(sock, IPPROTO_TCP, TCP_INFO, &info, &len); printf("%d\n", info.tcpi_snd_cwnd); return 0; }
TCP_INFO
getsockopt에 TCP_INFO를 사용하시면 됩니다. 리눅스 맨페이지 tcp(7)을 참고하세요. 다음은 예제 코드입니다.
#include <stdio.h> #include <sys/socket.h> #include <netinet/in.h> #include <netinet/tcp.h> int main() { int len; int sock; struct tcp_info info; sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); len = sizeof(info); getsockopt(sock, IPPROTO_TCP, TCP_INFO, &info, &len); printf("%d\n", info.tcpi_snd_cwnd); return 0; }