1,105,363 Community Members

perl socket

Member Avatar
coding101
Junior Poster in Training
77 posts since Apr 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Im trying to learn perl socket without the OO approach.

My get request isnt working, im not sure why.
Take a look?

#!/usr/bin/perl

use IO;
use Socket;


socket(SOCKFD,AF_INET,SOCK_STREAM,getprotobyname("tcp")) || die "Socket Error\n";

$host = gethostbyname("www.google.com");

$addr = sockaddr_in(80,$host);

connect(SOCKFD,$addr) || die "Connect Error\n";

print SOCKFD "GET /";

while(<SOCKFD>){
    print $_;
}
Member Avatar
Taywin
Posting Maven
2,632 posts since Apr 2010
Reputation Points: 134 [?]
Q&As Helped to Solve: 378 [?]
Skill Endorsements: 17 [?]
 
0
 

My get request isnt working

What does that mean? Not working means millions of things... Have to taken a look at Socket doc?

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article