What's the best way to communicate between processes?

Discussion in 'Python' started by awmcclain.nospam@gmail.com, Sep 27, 2006.

  1. Guest

    Here's my situation:

    I'm writing a simple reminder bot which will IM me based on input from
    a web server. Right now, I have a simple AIM bot written using twisted
    2 words. It logs into AIM and can send/receive messages. There's part
    1.

    I have a django server running under mod_python through apache, which
    is my web server. Part 2.

    How do I get part 2 to talk to part 1?? Ideally I'd like to fire off a
    (signal/message/data) from mod_python to a separate process running the
    twisted AIM bot, so that the mod_python thread(s) can just forget about
    the whole thing and let someone else deal with talking with AIM.

    I can't really just include the twisted AIM bot from django, because
    mod_python (as I understand it) runs different requests on different
    threads, and I don't want to spawn a bot and log into IM each request.
    I can't run the whole thing through twisted, either.

    I'm thinking about coding some sort of 'local notify server' in twisted
    (basically just listening to a socket and then passing the information
    to the IM bot), then connecting to it via a python socket in django and
    passing some serialized/pickled data. I worry about two requests
    connecting to the 'notify server' at once, though, because i *cannot*
    hang my web server.

    Thoughts? Is there a better solution? Is there a simpler way to do this
    (a way with built-in serialization?)

    Thanks for any help.
    , Sep 27, 2006
    #1
    1. Advertising

  2. In message <>,
    wrote:

    > I'm thinking about coding some sort of 'local notify server' in twisted
    > (basically just listening to a socket and then passing the information
    > to the IM bot), then connecting to it via a python socket in django and
    > passing some serialized/pickled data.


    That sounds like the right sort of thing. I've done this sort of thing
    myself, though I've been careful not to use any language-specific
    communication formats.

    > I worry about two requests
    > connecting to the 'notify server' at once, though, because i *cannot*
    > hang my web server.


    Your Web server won't hang. The particular Web server thread/process waiting
    for the request to be serviced will be held up, and so of course will the
    particular user sitting in front of the browser waiting for a response from
    that thread/process, but nobody else will notice anything.
    Lawrence D'Oliveiro, Sep 27, 2006
    #2
    1. Advertising

  3. Guest

    wrote:
    > I'm thinking about coding some sort of 'local notify server' in twisted
    > (basically just listening to a socket and then passing the information
    > to the IM bot), then connecting to it via a python socket in django and
    > passing some serialized/pickled data.


    Use the XML-RPC server gateway from Twisted on the server side. In
    the Django web pages then use xmlrpclib module to initiate XML-RPC
    requests to the server.

    Graham
    , Sep 27, 2006
    #3
  4. Guest

    In general, are sockets used for intra-machine communication less
    likely to fail/hang than, say, trying to connect across countries? I
    would think so, right?

    How do web servers handle connections to SQL databases? Do they spawn a
    thread? Or is it all inline? Seems like that's the type of
    behaviour/connection I'd like to model.



    Lawrence D'Oliveiro wrote:
    > In message <>,
    > wrote:
    >
    > > I'm thinking about coding some sort of 'local notify server' in twisted
    > > (basically just listening to a socket and then passing the information
    > > to the IM bot), then connecting to it via a python socket in django and
    > > passing some serialized/pickled data.

    >
    > That sounds like the right sort of thing. I've done this sort of thing
    > myself, though I've been careful not to use any language-specific
    > communication formats.
    >
    > > I worry about two requests
    > > connecting to the 'notify server' at once, though, because i *cannot*
    > > hang my web server.

    >
    > Your Web server won't hang. The particular Web server thread/process waiting
    > for the request to be serviced will be held up, and so of course will the
    > particular user sitting in front of the browser waiting for a response from
    > that thread/process, but nobody else will notice anything.
    , Sep 27, 2006
    #4
  5. In message <>,
    wrote:

    > ...


    Don't top-post.
    Lawrence D'Oliveiro, Sep 28, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Craig Buchanan

    Communicate between user controls

    Craig Buchanan, Jun 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,233
    Craig Buchanan
    Jun 30, 2003
  2. Gery D. Dorazio
    Replies:
    4
    Views:
    529
    Suvra B
    Nov 5, 2004
  3. Franck
    Replies:
    3
    Views:
    647
  4. CoffMan
    Replies:
    0
    Views:
    401
    CoffMan
    Sep 28, 2004
  5. Replies:
    7
    Views:
    135
Loading...

Share This Page