473,396 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Raw Sockets vs. What?

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

Jul 18 '05 #1
4 1333
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
Jul 18 '05 #2
"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>

Jul 18 '05 #3
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

Jul 18 '05 #4
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

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tero Saarni | last post by:
Hi, I have several threads communicating with each other using events stored in Queues. Threads block on Queue.get() until somebody publishes an event in thread's event queue. I need to add...
1
by: Tim Black | last post by:
My application requires sending a large piece (~2MB) of data to several devices on a network via TCP sockets. I have experimented with different methods for doing this and this has raised some...
1
by: Dmitry Akselrod | last post by:
Hello everyone, I have a vb.net application that wraps the TCPListener object in a class. The server connects to the local interface and establishes itself on port 9900. It then polls for...
4
by: BadOmen | last post by:
Hi, What is the different between 'System.Net.Sockets.Socket' and 'System.Net.Sockets.TcpClient'? When do I use System.Net.Sockets.TcpClient and System.Net.Sockets.Socket?? Yours, Jonas
2
by: Stressed Out Developer | last post by:
We have an application that has a 200 count loop that does the following: ' Each time thru the loop we pass the next IP Address is a range (aka 192.168.4.50 thru 192.168.4.254) Try If...
3
by: derSchweiz | last post by:
Hi, Experimenting with sockets, and I think I got it half working. I have the following code: Private Sub socket_receive(ByVal sender As Object, ByVal e As System.EventArgs) Handles...
0
by: richard.charts | last post by:
Well, unfortunately, I couldn't get any answer on the msdn forums, so I'll give it a shot here. Real question at the bottom....
0
by: rossabri | last post by:
This topic has been addressed in limited detail in other threads: "sockets don't play nice with new style classes :(" May 14 2005....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.