LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Closed Thread
  Search this Thread
Old 07-17-2008, 05:57 PM   #1
nsfocus
LQ Newbie
 
Registered: May 2008
Posts: 21

Rep: Reputation: 15
How to read data with IO::Socket in Perl?


I want to gather infos from the socket.
eg. I want get status code when I try to visit a website

I know how to connet web use IO::Socket,but how can I get the info from the socket connetction?
code is as below:
Code:

Code:
use IO::Socket;
$remote=IO::Socket::INET->new(
Proto=>'tcp',
PeerAddr=>"www.sina.com.cn",
PeerPort=>"80",
)
or die "can not reach that site";
while (<$remote>)
{print;
}
close $remote;

Last edited by nsfocus; 07-17-2008 at 06:10 PM.
 
Old 07-17-2008, 07:28 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate of http://www.linuxquestions.org/questi...socket-656487/.
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl .check if data are exist in the array before adding new data ufmale Programming 12 07-14-2010 05:26 AM
Perl:How to read data use IO::Socket ? nsfocus Programming 12 07-27-2008 07:57 PM
Read data from a socket allomeen Linux - Networking 1 05-08-2006 03:19 AM
Bad data in socket read function nhydra Programming 2 05-08-2006 03:16 AM
cannot read data at server socket, though client socket sends it jacques83 Linux - Networking 0 11-15-2005 01:58 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration