Stream Abstractions in python?

Irmen de Jong irmen at
Tue Mar 11 13:41:56 CET 2003

Daniel Nielsen wrote:
> I'm toying around with python... The only reason I see right now to
> continue using java for distributed stuff, is java's
> Data{In,Out}putStream with sockets. Is there an equivalent abstraction
> to TCP streams in Python? I have been looking around,
> but couldnt anything...

You should be looking on www.python.ORG instead.
For instance,

> Note: I do not require it to be compatible with java's streams, I'd
> just like the convenience of readUTF/writeUTF and friends.

If you want transparent object/data communication, I strongly
suggest you have a look at

Pyro uses pickling over TCP socket connections to transparently
implement remote method invocation, much like Java RMI.

You could also implement your own protocol if you wish,
where you use the pickle module to marshall your data objects
and use the makefile method of your socket object to create
a file-like stream to write your data to.

Irmen de Jong

More information about the Python-list mailing list