develooper Front page | perl.libnet | Postings from March 2008

Perl, Sockets and Select...

From:
Steffen Heil
Date:
March 26, 2008 00:51
Subject:
Perl, Sockets and Select...
Message ID:
216F59693D26431982EECD9B0D5E06AC@shs1
Hi

I need to write a perl programm, which connects two tcp sockets to each
other.
One will be a pure IO::Socket::INET (a), the other will propably something
link Net::HTTP::NB (b).
Seems easy:
Select on both.
  a.recv -> b.write_chunk
  b.read_entity_body -> a.send
That's it.

However I seem to be unable to do this in a non-blocking way.
Net::HTTP::NB has nonblocking read, but propably no non-blocking write.
Net::HTTP does no seem to be thread-safe.

Every incoming byte from one connection shall be forwarded to the other and
vice versa.
I know that HTTP is not really a good choise for this, but the connections
will be very low-bandwidth and only used very rarly. However I am bound to
use HTTP.

One other limitation is, that lateron I need to support HTTPS.

Any hints would be greatly appreciated.
Where should I start to read, what should I learn first or is there even
something similar?

Regards,
  Steffen



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About