首页 > Web开发 > 详细

perl6 Socket: 发送HTTP请求

时间:2017-08-23 09:18:20      阅读:271      评论:0      收藏:0      [点我收藏+]
sub MAIN(Str $host,Str $path,  Int $port) {
  my $send = "GET $path HTTP/1.1\r\nHost: $host\r\n\r\n";
  my $c = IO::Socket::INET.new(:host($host), :port($port));
  $c.print: $send;
  while (my $buff = $c.recv(1024)) {
    say $buff.print;
  }
  $c.close;
}

 

perl6 Socket: 发送HTTP请求

原文:http://www.cnblogs.com/perl6/p/7416272.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!