We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,725 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

perl socket

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 $_;
}
2
Contributors
1
Reply
1 Day
Discussion Span
4 Months Ago
Last Updated
4
Views
coding101
Junior Poster in Training
74 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

My get request isnt working

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

Taywin
Posting Maven
2,633 posts since Apr 2010
Reputation Points: 275
Solved Threads: 375
Skill Endorsements: 17

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0532 seconds using 2.65MB