Loading ...
Sorry, an error occurred while loading the content.

Server - client program : multiplexing file handles

Expand Messages
  • Arvind Raman
    Hi, I have been trying to write a server - client application using sockets. I bascially read through the following URLS
    Message 1 of 3 , Jul 26, 2006
    • 0 Attachment
      Hi,

      I have been trying to write a server - client application using
      sockets. I bascially read through the following URLS
      http://www.perlfect.com/articles/sockets.shtml
      http://www.perlfect.com/articles/select.shtml

      The idea is that I want to write a single-threaded sever application
      that will listen and comnunicate with multiple clients on a single
      port. After going through the abobe two links multiplexing through the
      file handles seemed to be the perfect way to design the application.

      However the problem I am facing is that I am unable to add the socket
      to the "read_set".

      The link below explains all the methods available on the "IO::Select" object.
      http://perldoc.perl.org/IO/Select.html

      I have attached the client and server application that I wrote to the mail.

      The problem I am facing is that once I add the server handle to the
      readset in line 18 of [server.pl] in the debug window if I issue the
      command
      $read_set->handles
      it returns an empty set.

      I am unable to figure out why I am unable to add handles to the read
      set,. Any help in this regard would be appreciated.

      Regards
      Arvind


      [Non-text portions of this message have been removed]
    • merlyn@stonehenge.com
      ... Arvind I have been trying to write a server - client application using Arvind sockets. I bascially read through the following URLS Arvind
      Message 2 of 3 , Jul 27, 2006
      • 0 Attachment
        >>>>> "Arvind" == Arvind Raman <ramanarvind@...> writes:


        Arvind> I have been trying to write a server - client application using
        Arvind> sockets. I bascially read through the following URLS
        Arvind> http://www.perlfect.com/articles/sockets.shtml
        Arvind> http://www.perlfect.com/articles/select.shtml

        That's far too low a level. Unless you want to spend all your time
        reinventing frequently used wheels, start with a framework like POE,
        and a protocol like HTTP.

        POE will help you write a single thread but multiple "session" process
        easier than nearly any other package, and there are lots of plugins
        for common protocols (like the client and server side of HTTP).

        See poe.perl.org for more details.

        --
        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
        <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
        Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
        See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
      • Dave Gray
        On 27 Jul 2006 05:15:22 -0700, merlyn@stonehenge.com ... These are also good resources if you want to understand more about what s going on behind the scenes:
        Message 3 of 3 , Jul 27, 2006
        • 0 Attachment
          On 27 Jul 2006 05:15:22 -0700, merlyn@...
          <merlyn@...> wrote:
          > >>>>> "Arvind" == Arvind Raman <ramanarvind@...> writes:
          >
          > Arvind> I have been trying to write a server - client application using
          > Arvind> sockets. I bascially read through the following URLS
          > Arvind> http://www.perlfect.com/articles/sockets.shtml
          > Arvind> http://www.perlfect.com/articles/select.shtml
          >
          > That's far too low a level. Unless you want to spend all your time
          > reinventing frequently used wheels, start with a framework like POE,
          > and a protocol like HTTP.
          >
          > POE will help you write a single thread but multiple "session" process
          > easier than nearly any other package, and there are lots of plugins
          > for common protocols (like the client and server side of HTTP).
          >
          > See poe.perl.org for more details.

          These are also good resources if you want to understand more about
          what's going on behind the scenes:
          <http://www.perlmonks.org/index.pl?node_id=288022>
          <http://perldoc.perl.org/perlthrtut.html>
        Your message has been successfully submitted and would be delivered to recipients shortly.