socket programming project

Discussion in 'Python' started by drs, Jun 26, 2003.

  1. drs

    drs Guest

    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
     
    drs, Jun 26, 2003
    #1
    1. Advertising

  2. On Thu, Jun 26, 2003 at 06:02:17AM +0000, drs wrote:
    > 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.
     
    Andrew Bennetts, Jun 26, 2003
    #2
    1. Advertising

  3. Hi,

    drs wrote:

    > 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/
     
    Maciej Sobczak, Jun 26, 2003
    #3
  4. drs

    drs Guest

    "Irmen de Jong" <> wrote in message
    news:3efb62a5$0$49109$4all.nl...

    >
    > 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
     
    drs, Jun 26, 2003
    #4
  5. drs wrote:

    > 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
     
    Irmen de Jong, Jun 27, 2003
    #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. Laszlo Nagy
    Replies:
    1
    Views:
    4,858
    Mark Wooding
    Jan 27, 2009
  2. Jean-Paul Calderone
    Replies:
    0
    Views:
    974
    Jean-Paul Calderone
    Jan 27, 2009
  3. Laszlo Nagy
    Replies:
    0
    Views:
    553
    Laszlo Nagy
    Feb 1, 2009
  4. Steve Holden
    Replies:
    0
    Views:
    669
    Steve Holden
    Feb 1, 2009
  5. Steve Holden
    Replies:
    1
    Views:
    724
Loading...

Share This Page