What does it take to implement a chat system in Python (Not askingfor code just advice before I star

S

Serhiy Storchaka

18.07.13 20:04, Terry Reedy напиÑав(ла):
To read this list as a newsgroup use news.gmane.org. The difference
between the mailing list interface and newsgroup interface is that the
latter automatically segregates messages by group and only downloads the
messages you want to read. Gmane is also a better way to search the
archive.

Also newsgroup interface allow you reply to messages that have already
been posted before your subscription.
 
G

Grant Edwards

18.07.13 20:04, Terry Reedy ??????????????(????):

Also newsgroup interface allow you reply to messages that have already
been posted before your subscription.

Indeed. I read about 20 mailing lists by pointing a newsreader (I use
slrn) at gmane.org. I find it to take far less effort than actualling
having all of those messages actually sent to me. For _some_ of the
gmane groups/lists you will actually have to subscribe to the mailing
list in question if you want to be allowed to post messages -- but in
your account settings for that mailing list server you can turn off
delivery, so that it doesn't actually send you any of the postings.

I really can't recommend gmane.org highly enough.

[I don't actually read the python list using gmane.org, since I've
read it from a Usenet news server via the group comp.lang.python since
long before I discovered gmane.org.]
 
O

Owen Marshall

18.07.13 20:04, Terry Reedy ??????????????(????):

Also newsgroup interface allow you reply to messages that have already
been posted before your subscription.

Indeed. I read about 20 mailing lists by pointing a newsreader (I use
slrn) at gmane.org. I find it to take far less effort than actualling
having all of those messages actually sent to me. For _some_ of the
gmane groups/lists you will actually have to subscribe to the mailing
list in question if you want to be allowed to post messages -- but in
your account settings for that mailing list server you can turn off
delivery, so that it doesn't actually send you any of the postings.

I really can't recommend gmane.org highly enough.

[I don't actually read the python list using gmane.org, since I've
read it from a Usenet news server via the group comp.lang.python since
long before I discovered gmane.org.]

Huh - I (foolishly) didn't realize gmane actually had NNTP, I've always
used it to search mailing lists. If the list dumped to usenet (much like
c.l.python) I'd post through sunsite.dk, which is a very nice usenet
provider. But that still meant several annoying mailing list
subscriptions.

.... man, I'm really glad I read your post :)
 
M

Michael Torrie

Not discourage you but this is a "been there, done that" kind of project.
You could learn more from reading somebody else is code. What hasn't been
done, and this would be very cool, is a chat program that works
peer-to-peer with no central server. To do this, you would probably need
to know about distributed hash tables and methods of piercing address
translation firewalls (think UDP).

University CS curricula across the world would disagree with your
assessment of the usefulness of "been there, done that." Indeed that's
how you learn by doing simple things that have been done many times
before, and discovering the magic of programming and software design.
My uni's CS undergrad degree consists of dozens of contrived projects
that have been done before. Web crawlers, compilers, expert systems,
chat systems, word counters, etc.

And that's the same way with all fields of endeavor. Indeed it'd be
silly to tell an enthused hobby builder that building a shed is
pointless as it's been done before. The shed itself, which would
arguably be useful, is beside the point.
 
M

Michael Torrie

Huh - I (foolishly) didn't realize gmane actually had NNTP, I've always
used it to search mailing lists. If the list dumped to usenet (much like
c.l.python) I'd post through sunsite.dk, which is a very nice usenet
provider. But that still meant several annoying mailing list
subscriptions.

... man, I'm really glad I read your post :)

I'm a bit confused. This list *is* c.l.python (I happen to read via
e-mail through the mailing list). So you can reach it from sunsite.dk
can you not?
 
O

Owen Marshall

I'm a bit confused. This list *is* c.l.python (I happen to read via
e-mail through the mailing list). So you can reach it from sunsite.dk
can you not?

Doesn't surprise me, I was confusing ;-)

What I was saying was that my workflow used to be this:

For maliing lists that dump to a newsgroup (c.l.python) I'd post to the
group via usenet (sunsite.dk)

For mailing lists that _do not_ have a direct newsgroup gateway (flask,
etc.) I'd have to subscribe and read them in my mail client.


So I used to think gmane was just a way of reading a bunch of mailing
lists. *But now* I know it is much more - it's an NNTP <==> mail gateway
that also has a web viewer.

Now I can point my slrn to news.gmane.net and see the flask mailing
list, ruby-talk, ... -- which I much prefer to using email.


Again, perfectly obvious stuff had I actually _read_ the gmane FAQ. But
who has time for that ;-)
 
J

Jake Angulo

I wanted to do a little project for learning Python. I thought a chat
system will be good as it isn't something that I have ever done.
...............
I wanted to know what will I need?
1 learn network/socket programming


I was actually expecting somebody to mention Twisted :)
(or Tornado)

You'll find it easy to use any of these frameworks to power the back-end
chat engine.
 
C

Chris Angelico

I was actually expecting somebody to mention Twisted :)
(or Tornado)

You'll find it easy to use any of these frameworks to power the back-end
chat engine.

For something this simple, what do they offer above the basic socket
module? I know that sounds critical but it's not meant to be; I've
never looked into either, as I've grown up using the BSD socket APIs
(in C, 80x86 assembly, C++, REXX, Java, Pike, and Python, on DOS (I
think), OS/2, Windows, and Linux... and possibly other
languages/platforms that I've now forgotten), and am comfortable with
them; but for someone who hasn't been in networking for two decades,
is there a noteworthy ease-of-starting difference? Bear in mind that
use of a framework locks you in to that framework and its ecosystem
(so, most likely, language), while grokking sockets themselves gives
you the freedom to move as required.

ChrisA
 
J

Jorgen Grahn

.
You can certainly do your server-side programming directly in Python;
in fact, I recommend it for this task. There's no reason to use HTTP,
much less a web framework (which usually consists of a structured way
to build HTML pages, plus a bunch of routing and stuff, none of which
you need). All you need is a simple structure for separating one
message from another.
I would recommend either going MUD/TELNET style
and ending each message with a newline, or prefixing each message with
its length in octets. Both ways work very nicely; newline-termination
allows you to use a MUD client for debugging, which I find very
convenient

It's definitely the way to go. It's not just MUDs -- a lot of
Internet protocols work that way. Netcat is one popular client for
talking to/debugging/testing such servers. No doubt MUD clients too,
but last time I did such stuff was in 1993, and I think I used telnet
....

In fact, I'd design the protocol before starting to write code. Or
better, steal some existing chat protocol. Like a subset of IRC.


There's also another question in the original posting that bothers me:
paraphrased "do I need to learn database programming to manage users"?
No! Unix does fine with plain-text files.

Managing credentials (understanding cryptography, setting up a support
organization for resetting lost passwords ...) is non-trivial though,
so try to do without such things at first. It's not obvious that you
should need an account for an experimental chat, anyway.

/Jorgen
 
C

Chris Angelico

It's definitely the way to go. It's not just MUDs -- a lot of
Internet protocols work that way. Netcat is one popular client for
talking to/debugging/testing such servers. No doubt MUD clients too,
but last time I did such stuff was in 1993, and I think I used telnet

Yeah. As I mentioned, I'm a MUDder with tens of thousands of online
hours on Threshold RPG[1], and have written several MUD clients; in
fact, I'm right now working on Gypsum (fun fun). The most common
internet protocols all:
* Involve a well-known TCP port and a single socket connection (apart from FTP)
* Begin with a one-line (usually) greeting from the server
* Have a line-based request-and-response system
* Have normal lines divided into "command" and "parameters" as per
shell commands
* (Usually) have an easy way to recognize success/failure, even
without understanding the whole response
* Are human-readable to the extreme
* Rely on lower-level protocols for encryption (eg TLS)

The mail trilogy (SMTP, POP, IMAP) are all like this, with the caveat
that IMAP tags commands and responses (so the second word, not the
first, is the command). FTP is almost there, apart from its secondary
data channel. MUDs are definitely right there. And when I started
putting together some networking facilities at work, I naturally
gravitated to this kind of system. Even when it's a purely internal
protocol, I like being able to just telnet/netcat to the service and
operate everything manually. To date, I think I've implemented five or
six such protocols within the suite at work, with only a couple of
systems done differently (one of them uses a PHP client, for
hysterical raisins, so it's done over HTTP).

Plus, it's great to be able to break out the MUD client at work
without getting in trouble for playing games on company time :)

ChrisA

[1] http://www.thresholdrpg.com/ if you'd like to join me! You'll be
made very welcome!
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top