Eric Wilhelm <[EMAIL PROTECTED]> writes: > Hi all, > > I'm trying to figure out whether this has been done before and/or > looking for suggestions on the best way to implement it. > > I would like the "publish" clients to connect to a server, then publish > their message and disconnect. (Optionally, they can stay connected and > publish more messages.) > > The "subscribe" clients would hold persistent connections to the server > (there are only 2 subscribers, though there could be more) and receive > the messages immediately after publication.
I have needed something like this a few times, and a good first crack is to use an IRC server. You can then use the Perl IRC clients to do both publication and subscription. IRC channels become subscription services. If you need to do something more complex than that, you will need something custom, but for simple requirements it's very fast and reliable. At one point I had to run the server on Windows, and I used a pure Perl IRC server with good success: http://pircd.sourceforge.net/ Another very straightforward technique is to use IP multicast. If I were doing it from scratch I would also consider Jabber/XMPP, just to see if it has anything interesting. You can simplify both of these by providing a network client that speaks a simple TCP-based protocol and relays messages to/from the IRC server/multicast network/Jabber server. I did this with a Perl script of about 10 lines, IIRC, and ran it under tcpserver, and it simplified client implementation greatly. I can probably dig up some of this code if it would be useful. Hope this helps, ----Scott.