l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
October 7: Social gathering
Next Installfest:
TBD
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
Page last updated:
2010 Oct 21 09:59

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Chat program in 100 lines of code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Chat program in 100 lines of code!



Very cool, nice walk though.  Kudos to Brian for a great post.

Posts like Brian's definitely lower the barrier to entry.  I enjoy
cut/paste type intros so you can tinker with something quickly and
painlessly.

I've been tinkering with similar with Python's twisted library.  I
figured I'd do a similar intro for a chat client using the python
twisted library.

1) Install twisted (apt-get/yum install python-twisted) or very similar
2) mkdir chat_server
3) go to
http://www.koders.com/python/fidD65298C63F7F8C0BFA09681B5981427544C470A9.aspx?s=wxpython
   And click download [1]
4) twistd -y chatserver.py
5) in two windows type telnet localhost 1025
6) binary package = 1MB or so (vs 44MB for ActiveMQ)
7) python chat server = 12MB resident (vs 200MB for ActiveMQ)

The differences I noted:
* 37 lines instead of 100 ish
* No nickname prefixes
* No editing of files or setting environment variables.
* Twisted is a library (to enable clients or servers) not a network
  service/daemon (like ActiveMQ).


For a more complete example I tinkered with ampchat:
1) apt-get install python-twisted
2) hg clone http://ripton.net/hg/ampchat
3) cd ampchat
4) python chatserver.py
5) in new window: python chatserver.py  file -> connect login: a password: a
6) in new window: python chatserver.py  file -> connect login: b password: b

The differences I noted:
* 580 lines instead of 100 ish
* client <-> server architecture
* GUI
* Usernames and passwords
* Shows who is connected.
* No editing of files or setting environment variables.
* can send messages to everyone or any subset of users.

Has anyone here written anything non-trivial in twisted?  ActiveMQ?

For the curious my interest in this is wanting to implement a simple
put/get encrypted protocol for binary blobs for a p2p backup system I'm
writing.

[1] Authoritative site
http://twistedsphinx.funsize.net/projects/core/examples/index.html has a
broken link for chatserver.py.  Also available in the twisted source
available at twistmatrix.com site.

_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.