PROJET AUTOBLOG


Shaarli - Les discussions de Shaarli

Archivé

Site original : Shaarli - Les discussions de Shaarli du 23/07/2013

⇐ retour index

Bash socket programming with /dev/tcp | Dave Smith's Blog

lundi 27 juillet 2015 à 11:43
GuiGui's Show - Liens
« Today I discovered a nifty way to do socket programming in bash without the need for netcat (nc) or telnet: /dev/tcp. Say you want to connect to Google and fetch their front page. Just do this:
exec 3<>/dev/tcp/www.google.com/80
echo -e "GET / HTTP/1.1\n\n" >&3
cat <&3 »

+ exec 3<& ; exec 3>&- pour fermer les descripteurs.

Amusant (et intéressant de voir que Bash a aussi ça en fonctionnalité interne) mais ça s'arrête là. :)

Via http://home.michalon.eu/shaarli/?vh0JUw mais la ressource pointée foire avec Firefox d'où mon choix d'une autre ressource pour expliquer la même chose. :)
(Permalink)