python server

L

linuxpld

Hello

I`m writing a program (server in future) in python.
I would like to write it in such a way that I will be able to write gui
in any language and connect to my python program and use functionality
included with it.
are there any libraries that I could use?

I dont know if i wrote it understandably but maybe picture will explain
it:

|------------|
| python |
| | <- module in python -> <- connection ("???") -> <-gui in
any language (java, c++, python, etc).
| server |
|-----------|
what could I use as "???"? http? mqseries? webservices? what are the
possibilites?

thx for answers
linuxfan
 
B

Bill Mill

Hello

I`m writing a program (server in future) in python.
I would like to write it in such a way that I will be able to write gui
in any language and connect to my python program and use functionality
included with it.
are there any libraries that I could use?

Lots...Perhaps you should start off in understanding your problem by
learning about sockets:
http://www.amk.ca/python/howto/sockets/

Sockets are a generalized method for passing data between programs on
the same or different computers.
I dont know if i wrote it understandably but maybe picture will explain
it:

|------------|
| python |
| | <- module in python -> <- connection ("???") -> <-gui in
any language (java, c++, python, etc).
| server |
|-----------|
what could I use as "???"? http? mqseries? webservices? what are the
possibilites?

http, webservices, xmlrpc, corba, people to type in messages between
programs, carrier pigeons, and sockets are all possibilities. I'm
gonna recommend that you learn sockets, because they're a general
solution to this problem, and many methods of inter-program
communication are based on sockets, but I don't know the specifics of
the program you're designing.

How tightly will the client and server interact? In what environment
(ie over the internet, over a corporate LAN, on the same computer, on
Internet2)? Is there any framework in existance, or is this program
being written from scratch?

Peace
Bill Mill
bill.mill at gmail.com
 
M

Magnus Lycka

linuxpld said:
I`m writing a program (server in future) in python.
I would like to write it in such a way that I will be able to write gui
in any language and connect to my python program and use functionality
included with it.
are there any libraries that I could use?

Thee are many solutions. An XML-RPC server springs to mind as a
solution. There are several Python XML-RPC servers, and clients
for a wide range of languages, see:
http://xmlrpc.scripting.com/directory/1568/implementations

Plain sockets can work of course, but that's fairly low
level: You'll need to device a protocol etc.

For more possible solutions, see
http://www.thinkware.se/cgi-bin/thinki.cgi/UsingPythonWithOtherLanguages
 
F

Frithiof Andreas Jensen

linuxpld said:
Hello

I`m writing a program (server in future) in python.
I would like to write it in such a way that I will be able to write gui
in any language and connect to my python program and use functionality
included with it.
are there any libraries that I could use?

That depends on what you want and what other "goodies" you want.

I liked "Python Web Modules" http://www.pythonweb.org/ a lot, mostly because
I needed a decent Database interface and because you do not have to "buy"
the entire framework like you do with f.ex. CORBA if you only want to use
some of it. Everything runs a browser these dayz.

Another possibility is to write a command-line interpreter that takes
commands from a socket and returns results. All ASCII of course. ASCII is
easy to debug.

This is very generic, robust and easy to write test scripts for. The
disadvantage is that you need a parser in the GUI and one in the
Application. The huge advantage is that you completely separate the
internals of the two programs from each other.

Most client-server UNIX/Linux applications are written this way; i.e. this
programming method survives in the wild because it is stable and it works.
The RPC frameworks tend to run up on a wild hype-cycle before being
generally left to maintenance programmers to sort out.

Consider a "Mailbox" system, where packages of work is send to a server
process and processed results are shipped back to the client process. The
trick is to keep all state inside the "work packages" so the servers do not
need to track anything. "MAKE" is a file-based implementation of this.


OTOH:

For Python <-> Python situations, the "Python Remote Objects", PYRO is not
bad at all. And it does have an Event mechanism, which can be used as a
"Mailbox" service. For reliable "shared memory" tasks ZOPE is good or maybe
SPREAD.

CORBA is overkill for everything, IMO ;-)
 
F

Frithiof Andreas Jensen

Thee are many solutions. An XML-RPC server springs to mind as a
solution. There are several Python XML-RPC servers
......

Good Idea. Seems that those particular batteries are included with Python
2.2 and up:

OP: See help on: "SimpleXMLRPCServer" and "xmlrpclib"
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,270
Messages
2,571,348
Members
48,034
Latest member
JaimieBarn

Latest Threads

Top