gkr*_*gkr 1 sockets linux ubuntu wget strace
"strace wget grooveshark.com"停止了奇怪的套接字调用,错误的字符串长度,我必须按Ctrl + C终止.
write(2, "Connecting to grooveshark.com (g"..., 67Connecting to grooveshark.com (grooveshark.com)|8.20.213.76|:80... ) = 67
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("8.20.213.76")}, 16) = 0
write(2, "connected.\n", 11connected.
) = 11
select(4, NULL, [3], NULL, {900, 0}) = 1 (out [3], left {899, 999993})
write(3, "GET / HTTP/1.1\r\nUser-Agent: Wget"..., 115) = 115
write(2, "HTTP request sent, awaiting resp"..., 40HTTP request sent, awaiting response... ) = 40 [[ Check this line ]]
select(4, [3], NULL, NULL, {900, 0} ^C
Run Code Online (Sandbox Code Playgroud)
写(2,"发送HTTP请求,等待resp"...,发送40HTTP请求,等待响应......)= 40
应该
写(2,"发送HTTP请求,等待响应......",40)= 40
但strace wget google.com给出了
write(3, "GET / HTTP/1.1\r\nUser-Agent: Wget"..., 116) = 116
write(2, "HTTP request sent, awaiting resp"..., 40) = 40
select(4, [3], NULL, NULL, {900, 0}) = 1 (in [3], left {899, 932611})
Run Code Online (Sandbox Code Playgroud)
并妥善终止.
谢谢
你看到wget的输出与strace的输出混合在一起.使用-o选项strace将跟踪存储在文件中,以便不会发生这种情况.
写(2,"发送HTTP请求,等待resp"...,发送40HTTP请求,等待响应......)= 40
wget中的这个写调用将消息打印到stderr,在它返回之前,它的输出在终端中看到,在40和右括号之间