Raw Sockets vs. What?

Discussion in 'Python' started by Matt, Dec 11, 2004.

  1. Matt

    Matt Guest

    Hi,

    I'm new to Python (1 week), but I'm writing an out-of-process debugger
    for a Python ide. I tried execFile first, but stuff leaked over from
    the wx libraries we are using. And, anyway, the next code set is PHP so
    this has to be tackled anyway.

    So, the question: How to communicate between two instances of the
    python interpreter? Specifically, I need to pass the api and objects
    from bdb, the base class for the debugger. One interpreter runs the
    ide, the other the debugger and client code. We were talking and just
    opening a socket and doing the rest from there came up. This, to me,
    (admitedly a java guy) seems like a lot of work. If it were just
    setting breakppoints and stepping, well ok. But I also want to have
    introspection on the debugger side objects.

    I could use raw sockets and write a bunch of stuff.

    Does anyone have a suggestion about some pythonesque way to tackle
    this?

    Many thanks in advance,
    Matt
    Matt, Dec 11, 2004
    #1
    1. Advertising


  2. > So, the question: How to communicate between two instances of the
    > python interpreter? Specifically, I need to pass the api and objects
    > from bdb, the base class for the debugger. One interpreter runs the
    > ide, the other the debugger and client code. We were talking and just
    > opening a socket and doing the rest from there came up. This, to me,
    > (admitedly a java guy) seems like a lot of work. If it were just
    > setting breakppoints and stepping, well ok. But I also want to have
    > introspection on the debugger side objects.
    >
    > I could use raw sockets and write a bunch of stuff.
    >
    > Does anyone have a suggestion about some pythonesque way to tackle
    > this?


    I've found pyro useful for a similar task: I fork, create a pipe and in the
    child I create a pyro daemon to run a remote object. The uri of that then
    is passed using the pipe, so that the parent can get a reference to the
    remote object.

    I do the whole exercise due to not killable threads in python - so that I
    can terminate the subprocess.

    The nice thing about pyro is that it is like corba without the declartive
    stuff - just use it.

    You also migh check out the eric ide - it has an out-of-process debugger, so
    Detlev must have found a solution :)
    --
    Regards,

    Diez B. Roggisch
    Diez B. Roggisch, Dec 11, 2004
    #2
    1. Advertising

  3. "Matt" wrote:

    > So, the question: How to communicate between two instances of the
    > python interpreter? Specifically, I need to pass the api and objects
    > from bdb, the base class for the debugger. One interpreter runs the
    > ide, the other the debugger and client code. We were talking and just
    > opening a socket and doing the rest from there came up. This, to me,
    > (admitedly a java guy) seems like a lot of work. If it were just
    > setting breakppoints and stepping, well ok. But I also want to have
    > introspection on the debugger side objects.
    >
    > I could use raw sockets and write a bunch of stuff.
    >
    > Does anyone have a suggestion about some pythonesque way to tackle
    > this?


    let the debugger listen to a randomly chosen local port, let the client wrapper
    connect back to the debugger via that port, and use a suitable marshalling layer
    to wrap commands and data for the introspection part. This has been done many
    times by many IDE developers (including yours truly). Designing the "RPC API"
    is the only tricky part here, and it doesn't have to be that tricky (some people
    are known to use really simply stuff, such as XML-RPC, for this purpose).

    Unless I'm completely mistaken, recent versions of IDLE have a remote debugger
    designed and implemented by GvR himself. Maybe you could use that code right
    out of the box?

    </F>
    Fredrik Lundh, Dec 11, 2004
    #3
  4. Matt

    Matt Guest

    Thanks for the responses--they were very helpful. I've looked at IDLE
    and pyro and I think I'll try using pyro for this first version.

    --Matt
    Matt, Dec 12, 2004
    #4
  5. Matt

    Matt Guest

    Just thought I'd follow up to say that I'm using XML-RPC after all. Not
    that I was intimidated when I finally learned that Fredrik had written
    the thing. No, it was more the issue that we want to write a php
    debugger next and XML-RPC plays well with php, too.
    Thanks again,
    --Matt
    Matt, Jan 8, 2005
    #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. Guillaume Kaddouch

    RAW Sockets on Windows XP

    Guillaume Kaddouch, Dec 26, 2003, in forum: C++
    Replies:
    1
    Views:
    5,332
    Jack Klein
    Dec 27, 2003
  2. Lars Strand

    IPv6 header on raw sockets?

    Lars Strand, Feb 19, 2004, in forum: Python
    Replies:
    0
    Views:
    758
    Lars Strand
    Feb 19, 2004
  3. ionel

    raw sockets please

    ionel, Apr 5, 2005, in forum: Python
    Replies:
    1
    Views:
    292
    Peter Hansen
    Apr 5, 2005
  4. billiejoex

    Sniffer with RAW SOCKETS

    billiejoex, Sep 7, 2005, in forum: Python
    Replies:
    1
    Views:
    401
    Grant Edwards
    Sep 7, 2005
  5. Matthias Guentert

    Raw Sockets - IP-Encapsulation

    Matthias Guentert, Sep 23, 2010, in forum: Python
    Replies:
    2
    Views:
    814
    Alexander Gattin
    Sep 27, 2010
Loading...

Share This Page