in reply to Trying to get started with IO::Multiplex

After sleeping on this problem I have made quite a bit of progress. Having yet another sample program from the Internet that didn't work was frustrating and I got a bit of tunnel vision. Here is what I have figured out and where I am at now:

1) The port number listed in the server and client code needs to be the same.

2) The server binds to the port and listens on it.

3) The client binds to a port that is random appearing to me. The client will send to the port listed in the code and listen on the random appearing port number.

4) I misunderstood what the code should do and got a case of tunnel vision. I didn't pay attention to the easy parts of the code. I thought that the server and the client would chat with each other (like sample code from my past). This code does not do that. This code has the server echo out everything to all clients. Thus, with multiple clients running in multiple terminal windows I have clients chatting with each other.

5) I still don't understand why I get the four client error messages as listed in my initial posting. They are all in the Multiplex.pm module. Later I can try to look at the module code but I suspect that it is well above beginner level.

Any ideas on the error messages?

Thanks,
Bruce
  • Comment on Re: Trying to get started with IO::Multiplex

Replies are listed 'Best First'.
Re^2: Trying to get started with IO::Multiplex
by zentara (Cardinal) on Jan 17, 2011 at 14:58 UTC
    The four client error messages are: Use of uninitialized value in unpack at /usr/share/perl5/IO/Multiplex. +pm line 352. Use of uninitialized value in numeric eq (==) at /usr/share/perl5/IO/M +ultiplex.pm line 352. Use of uninitialized value in unpack at /usr/share/perl5/IO/Multiplex. +pm line 352. Use of uninitialized value in numeric eq (==) at /usr/share/perl5/IO/M +ultiplex.pm line 352.
    Any ideas on the error messages?

    It sounds like your problem is in the module at line 352. :-)

    So use a local copy of the module,( or even edit the module as root for testing), and see what is getting handed off at line 352.

    My ESP guesses the Multiplex module expects an array and is only getting a single value? You have to dig in and see.

    OR.... go for a more standard solution using IO::Select or forked/threaded servers. Google for many previously posted code examples or visit the tutorials here at Perlmonks.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
      I will take a look at line 352 but I suspect that IO::Select will look better now that I have something working. So far my only push toward IO::Multiplex was "THEY SAID" that it was easier. I have been around long enough to know that I should be careful with any quote of Mr./Mrs. They.

      Thank you,
      Bruce