[San-Diego-pm] A few questions of Perl

Gautam Dey gautam.dey77 at gmail.com
Wed Dec 9 22:14:25 PST 2009


Alex,

  There are a few ways to do this. It is definitely doable in perl.
The hard way, is to use select and Socket or Socket::IO, with two
sockets open on to two different ports. You can then use one as a read
socket and another as a write socket.. However, if you do not want to
manage the run loop, where you are checking on select in a while(1)
look to see if there are any message, you can use POE
(http://search.cpan.org/dist/POE/) or something like AnyEvent
(http://search.cpan.org/~mlehmann/AnyEvent-5.22/lib/AnyEvent.pm) to
help you out. I'd recommend using POE or AnyEvent.

POE takes a bit to understand but was created for this very purpose.

Gautam.




2009/12/9 Bob Kleemann <rkleeman at energoncube.net>:
> Alex,
>
> I know that you can do what you are looking for, but I haven't done them
> myself.  Therefore I'm forwarding your message to the group to see who has
> some answers for you.
>
> Perl Mongers,
>
> Can you help Alex out.  Please include his address on replies, as I don't
> believe he is subscribed to our mailing list yet.  (Alex, see our website
> for information about subscribing to our low-volume list.)
>
> On Tue, Dec 8, 2009 at 11:00 PM, Alex (Yu) Hu <foxele at gmail.com> wrote:
>>
>> Hi:
>>
>> I am sorry to E-mail you like this. My name is Alex Hu. I am living in San
>> Diego. I am  working on a perl program that
>> is suppose to be a test application running on PC.
>>
>> I got your E-mail address by following links from Perl Monger website. I
>> needed help urgently and I
>> don't know where to turn to. That's why I am trying your E-mail address.
>>
>> If you don't mind, I have two questions regarding Perl:
>>
>> 1. The perl program I am running has a network interface which is acting
>> like a TCP client. For some
>> reason, I want the client to send message on one port and receive message
>> on the other port. Is this
>> possible in perl?  I have a module does the send and receive on one port,
>> but I don't know how to
>> add a second one.
>>
>> 2. Is there a event scheduler modules I can use to schedule the sending of
>> a message say several milisecond in the future.
>>
>> Once again, I am sorry about my E-mail.
>>
>> Thanks.
>> --
>> Alex Hu
>
>
> _______________________________________________
> San-Diego-pm mailing list
> San-Diego-pm at pm.org
> http://mail.pm.org/mailman/listinfo/san-diego-pm
>


More information about the San-Diego-pm mailing list