socket programming project

D

drs

Hi,

I have a programming design question. I would like to do this in Python,
but I am not even sure about what tools are proper or where to start
reading.

I am trying to make a small network system where several client computers
connect to a server. each client can send messages to the server which must
alert all of the clients of the information in the messages. Further, the
server must be able to alert all connected clients about other occasional
information. The total number of messages is low, however. for now, security
is not an issue if that matters.

I know a way to do this in win32 using dcom, but this seems sloppy, and i
need it to run on freebsd and win32 at a minimum, and pocketPC if at all
possible. I also thought about using ZEO coupled with a Queue class, but I
am not sure about clients reacting to events in this case, or about ZODB/ZEO
on pocketPC.

(The specifics of the project are to make a wifi enabled jukebox out of an
old freebsd computer hooked to my stereo which can be controlled by all of
the other computers in the house. I did a previous version of this using
SimpleHTTPServer, but this seems a dead end for forcing the playlist queue
and such onto clients.)

Any suggestions on how to start would be appreciated.

Thanks,

doug
 
A

Andrew Bennetts

Hi,

I have a programming design question. I would like to do this in Python,
but I am not even sure about what tools are proper or where to start
reading.

An excellent tool for socket programming is Twisted:
http://twistedmatrix.com/
I am trying to make a small network system where several client computers
connect to a server. each client can send messages to the server which must
alert all of the clients of the information in the messages. Further, the
server must be able to alert all connected clients about other occasional
information. The total number of messages is low, however. for now, security
is not an issue if that matters.

You might like PB, Twisted's remote object protocol, which can do all this.
It might be overkill though; I recommend you take a look at the docs and
decide for yourself. Twisted also has support for lots of standard
protocols, including stuff like XML-RPC.

If you want to use a custom protocol, that's also pretty easy in Twisted.
I know a way to do this in win32 using dcom, but this seems sloppy, and i
need it to run on freebsd and win32 at a minimum, and pocketPC if at all
possible. I also thought about using ZEO coupled with a Queue class, but I
am not sure about clients reacting to events in this case, or about ZODB/ZEO
on pocketPC.

Twisted runs on FreeBSD and Win32, and I seem to recall someone got it
working on a PocketPC or something like it without too much effort.
(The specifics of the project are to make a wifi enabled jukebox out of an
old freebsd computer hooked to my stereo which can be controlled by all of
the other computers in the house. I did a previous version of this using
SimpleHTTPServer, but this seems a dead end for forcing the playlist queue
and such onto clients.)

That sounds like an excellent use for Twisted. I don't think it's actively
developed, but there's a project called "mc-foo" that is a Jukebox using
Twisted. You may want to start there, rather from scratch.

-Andrew.
 
M

Maciej Sobczak

Hi,
I am trying to make a small network system where several client computers
connect to a server. each client can send messages to the server which must
alert all of the clients of the information in the messages. Further, the
server must be able to alert all connected clients about other occasional
information. The total number of messages is low, however. for now, security
is not an issue if that matters.

You may find the YAMI project:

http://www.maciejsobczak.com/prog/yami/

to be very useful for your needs.
i
need it to run on freebsd and win32 at a minimum, and pocketPC if at all
possible.

YAMI works fine on FreeBSD, Linux, MS Windows and SunOS. I did not try
it on PocketPC, but chances are it will go, if you know how to write
Makefiles for this platform. ;)

--
Maciej Sobczak
http://www.maciejsobczak.com/

Distributed programming lib for C, C++, Python & Tcl:
http://www.maciejsobczak.com/prog/yami/
 
D

drs

If you don't care about the communication internals, (and it seems very
likely that you don't), try Pyro : http://pyro.sourceforge.net

Pyro makes it VERY easy to build distributed object systems in Python.
(a basic client and server take no more than 5 to 10 lines of code,
of which only two or three are Pyro-specific).

If you know DCOM, you know the basics of distributed object systems,
and you should feel at home very soon when using Pyro.
Not forgetting that it is tremendously easier to use than DCOM.. ;-)

This looks really interesting. In COM, there is the concept of a single use
server where every client shares the same instance. Python does not really
support creating a single use DCOM server, at least not last time I looked
into it. Is this something Pyro can easily do, or will I need to use a db of
some sort to keep track of shared data?

-doug
 
I

Irmen de Jong

drs said:
This looks really interesting. In COM, there is the concept of a single use
server where every client shares the same instance. Python does not really
support creating a single use DCOM server, at least not last time I looked
into it. Is this something Pyro can easily do, or will I need to use a db of
some sort to keep track of shared data?

It actually is the default in Pyro :)

You're creating Pyro server object instances. Every object instance can
be referred to by a unique logical name. If your Pyro client connects to the
logical name, it will remotely access the same object instance that all
other clients that requested that object by that name also do.

So, the object's state is always shared in Pyro. This means that your
object's implementation must be able to deal with concurrent /
multithreaded invocations (although Pyro can help you a bit with this).

--Irmen de Jong
 

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

Similar Threads

Socket programming in C on Windows 0
socket programming 8
School Project 1
Java programming 1
Text File Only Programming 1
Programming challenge? 4
My New project 1
Java socket programming 1

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top