您的位置:首页 > 其它

IO::Socket

2016-05-19 10:21 141 查看
#!/usr/bin/perl -w
use strict;
use IO::Socket;

my $host = "www.chinaunix.net";
my $port = "80";
my $http_head = "GET / HTTP/1.0\nHost: $host:$port\n\n";
my $sock = IO::Socket::INET->new("$host:$port")
or die "Socket() error, Reason : $! \n";

print $sock $http_head;
print <$sock>;

exit 0;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: