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

Perl, Sockets and Select...

Steffen Heil
March 26, 2008 00:51
Perl, Sockets and Select...
Message ID:

I need to write a perl programm, which connects two tcp sockets to each
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?

  Steffen Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About