Using /dev/tcp instead of wget

Posted by User1 on Stack Overflow See other posts from Stack Overflow or by User1
Published on 2010-05-04T23:16:22Z Indexed on 2010/05/04 23:38 UTC
Read the original article Hit count: 213

Filed under:
|
|

Why does this work:

exec 3<>/dev/tcp/www.google.com/80
echo -e "GET / HTTP/1.1\n\n">&3
cat <&3

And this fail:

echo -e "GET / HTTP/1.1\n\n" > /dev/tcp/www.google.com/80
cat </dev/tcp/www.google.com/80

Is there a way to do it in one-line w/o using wget, curl, or some other library?

© Stack Overflow or respective owner

Related posts about wget

Related posts about bash