473,324 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Read/Write IO on socket file descriptor?

Hi all,

I'm trying to perform read and write I/O on a socket file descriptor
received for another process via a Unix Domain Socket. In trying to
understand all this I came up with a small test script that is not
working for me:
use strict ;
use IO::Socket::INET ;

my $socket = new IO::Socket::INET(
PeerAddr => 'www.perl.com',
PeerPort => 80,
Proto => 'tcp',
) ;

my $rfd = fileno($socket) ;
my $rfh = new IO::Handle->fdopen($rfd, "r") ;
my $wfd = fileno($socket) ;
my $wfh = new IO::Handle->fdopen($wfd, "w") ;

print "$rfd $rfh $wfd $wfh\n" ;
print $wfh "GET / HTTP/1.0\n\n" ;
print "Sent GET...\n" ;
my $line = <$rfh> ;
print $line ;
Should this work? It seems as though printing to $wfh
does nothing, and then the <$rfh> is hanging.

If this is not the way to go about this, what else can I do
to perform read AND write I/O on a socket file descriptor?

I'm using Perl 5.6.1 on Linux RH 7.1

Thanks,

Patrick LeBoutillier
Jul 19 '05 #1
1 10099

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: zhushenli | last post by:
Hello all, How to random read/write the file in fstream? BTW, how to access the file in block? Regards, Davy
5
by: Martin Svensson | last post by:
Hello! I need some help/recommendations on how to do the following. I have a program that writes an IP address two control numbers and a date to file, on one line. It's a basic text file and it...
8
by: Patrik Malmström | last post by:
How do I read, write a file binary? I want to open, say, file.exe read it in to the program, then write it out to file2.exe. Like file copy, anyone have a code sample?
2
by: Paul M | last post by:
Hy all In c# how can I read/write ini file? I need this for back compatibility. Is possible little example? For future, what is the best practice to replace ini file? app.config? xml files??...
0
by: Ahmed A. | last post by:
This will be very helpfull for many! Using RichTextBox Read/Write Unicode File http://www.microsoft.com/indonesia/msdn/wnf_RichTextBox.as p Private Function ReadFile(ByVal myfile As String)...
3
by: Trint Smith | last post by:
Is there anything like this that will allow a url address instread of a drive letter?: Dim fw As StreamWriter fw = New StreamWriter("D:\file.txt", True) fw.WriteLine(ex) fw.Close() The...
2
by: David Lozzi | last post by:
Howdy, Trying to open and read/write another aspx file from my aspx page. Basically I want to be able to update my aspx files from the website. Here's my code so far: Dim path As String =...
10
by: lorenzogordon | last post by:
Hi there, I'd greatly appreciate any insights into the following problem: I've got PHP running fine on IIS (OS: Server 2003, SP1; IIS: 6.0; PHP: 4.3.11). In PHP, the user uploads a file,...
9
mickey0
by: mickey0 | last post by:
Hi, I have one problem; I must read a html like this; <html> <body> Hello </body> </html> I read this in a string (correct?) and after I have to do some changes to it and write it on disk...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.