Best method for inter process communications

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JamesHoward

    #1

    Best method for inter process communications

    I am looking for a way of performing inter process communication over
    XML between a python program and something else creating XML data.

    What is the best way of performing this communication? I could bind a
    socket to localhost and perform the data transfer that way, but that
    seems inefficient due to the addition of TCP/IP or UDP/IP overhead.
    Is there a way to stream data via a custom datastream (I.E. not STDIO,
    STDERR, etc)?

    Thanks in advance,
    Jim Howard

  • marduk

    #2
    Re: Best method for inter process communications

    On Mon, 2007-07-16 at 17:22 +0000, JamesHoward wrote:
    I am looking for a way of performing inter process communication over
    XML between a python program and something else creating XML data.
    >
    What is the best way of performing this communication? I could bind a
    socket to localhost and perform the data transfer that way, but that
    seems inefficient due to the addition of TCP/IP or UDP/IP overhead.
    Is there a way to stream data via a custom datastream (I.E. not STDIO,
    STDERR, etc)?
    In *nix, you could also use a named pipe for cheap RPC (os.mkfifo()).

    -a

    Comment

    • Steve Holden

      #3
      Re: Best method for inter process communications

      JamesHoward wrote:
      I am looking for a way of performing inter process communication over
      XML between a python program and something else creating XML data.
      >
      What is the best way of performing this communication? I could bind a
      socket to localhost and perform the data transfer that way, but that
      seems inefficient due to the addition of TCP/IP or UDP/IP overhead.
      Is there a way to stream data via a custom datastream (I.E. not STDIO,
      STDERR, etc)?
      >
      Nothing that portable across different platforms, I suspect.

      However I see no reason why you can't use pipelines in Unix (in other
      words what's wrong with using stdin/stdout?), and Windows offers
      something called a named pipe. You could even use shared memory if you
      wanted.

      Given the radically inefficient representations that XML typically
      requires, however, I think that worrying about localhost socket overhead
      is unnecessary: if your application was *that* critical you wouldn't be
      using XML in the first place.

      regards
      Steve
      --
      Steve Holden +1 571 484 6266 +1 800 494 3119
      Holden Web LLC/Ltd http://www.holdenweb.com
      Skype: holdenweb http://del.icio.us/steve.holden
      --------------- Asciimercial ------------------
      Get on the web: Blog, lens and tag the Internet
      Many services currently offer free registration
      ----------- Thank You for Reading -------------

      Comment

      • Grant Edwards

        #4
        Re: Best method for inter process communications

        On 2007-07-16, JamesHoward <James.w.Howard @gmail.comwrote :
        I am looking for a way of performing inter process communication over
        XML between a python program and something else creating XML data.
        >
        What is the best way of performing this communication? I could bind a
        socket to localhost and perform the data transfer that way, but that
        seems inefficient due to the addition of TCP/IP or UDP/IP overhead.
        Is there a way to stream data via a custom datastream (I.E. not STDIO,
        STDERR, etc)?
        You could use a named pipe or a Unix domain socket. The nice
        thing about an IP socket is that you get network transparancy:
        the two programs can be moved to two different machines.

        --
        Grant Edwards grante Yow! It's the RINSE CYCLE!!
        at They've ALL IGNORED the
        visi.com RINSE CYCLE!!

        Comment

        • JamesHoward

          #5
          Re: Best method for inter process communications

          Thanks for the updates. I think I will try named processes first, but
          may just end up using local sockets in the end and not worry about the
          overhead.

          Jim Howard

          Comment

          • Hendrik van Rooyen

            #6
            Re: Best method for inter process communications

            "Steve Holden" <steve@holdenwe b.comwrote:
            Given the radically inefficient representations that XML typically
            requires, however, I think that worrying about localhost socket overhead
            is unnecessary: if your application was *that* critical you wouldn't be
            using XML in the first place.
            I heard a rumour once that a "hello world" string takes something like
            10k bytes in XMLRPC - have never bothered to find out if its BS...

            - Hendrik

            Comment

            • Marc 'BlackJack' Rintsch

              #7
              Re: Best method for inter process communications

              On Tue, 17 Jul 2007 08:08:45 +0200, Hendrik van Rooyen wrote:
              I heard a rumour once that a "hello world" string takes something like
              10k bytes in XMLRPC - have never bothered to find out if its BS...
              Just try it out:

              In [8]: import xmlrpclib

              In [9]: a = xmlrpclib.dumps (('hello world',))

              In [10]: len(a)
              Out[10]: 80

              In [11]: print a
              <params>
              <param>
              <value><string> hello world</string></value>
              </param>
              </params>

              Even with some additional boilerplate like XML declaration etc. there is
              still a little bit room until 10 kB are reached. :-)

              Ciao,
              Marc 'BlackJack' Rintsch

              Comment

              • Irmen de Jong

                #8
                Re: Best method for inter process communications

                JamesHoward wrote:
                I am looking for a way of performing inter process communication over
                XML between a python program and something else creating XML data.
                What is that "something else"?
                --irmen

                Comment

                • Hendrik van Rooyen

                  #9
                  Re: Best method for inter process communications

                  "Marc 'BlackJack' Rintsch" <bj_666@....net wrote:
                  On Tue, 17 Jul 2007 08:08:45 +0200, Hendrik van Rooyen wrote:
                  I heard a rumour once that a "hello world" string takes something like
                  10k bytes in XMLRPC - have never bothered to find out if its BS...
                  Just try it out:

                  In [8]: import xmlrpclib

                  In [9]: a = xmlrpclib.dumps (('hello world',))

                  In [10]: len(a)
                  Out[10]: 80

                  In [11]: print a
                  <params>
                  <param>
                  <value><string> hello world</string></value>
                  </param>
                  </params>

                  Even with some additional boilerplate like XML declaration etc. there is
                  still a little bit room until 10 kB are reached. :-)

                  LOL - so one could say it was a bit of an exaggeration...

                  Thanks - Hendrik

                  Comment

                  Working...