Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #50897

Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)

References <1f3e15e8-bbd3-457c-85f4-c5f251b3e744@googlegroups.com> <mailman.4823.1374123184.3114.python-list@python.org> <432d1377-8421-479d-a560-962158de2e15@googlegroups.com> <mailman.4827.1374128723.3114.python-list@python.org> <slrnkui8h5.2m9.grahn+nntp@frailea.sa.invalid>
Date 2013-07-19 21:56 +1000
Subject Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.4863.1374235007.3114.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Jul 19, 2013 at 9:25 PM, Jorgen Grahn <grahn+nntp@snipabacken.se> wrote:
> On Thu, 2013-07-18, Chris Angelico wrote:
> ...
>> 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

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!

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Aseem Bansal <asmbansal2@gmail.com> - 2013-07-17 21:36 -0700
  Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) vikash agrawal <vikashagrawal1990@gmail.com> - 2013-07-18 10:22 +0530
    Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Aseem Bansal <asmbansal2@gmail.com> - 2013-07-17 23:11 -0700
      Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Chris Angelico <rosuav@gmail.com> - 2013-07-18 16:25 +1000
        Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Aseem Bansal <asmbansal2@gmail.com> - 2013-07-17 23:36 -0700
          Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Andrew Berg <robotsondrugs@gmail.com> - 2013-07-18 01:49 -0500
            Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Aseem Bansal <asmbansal2@gmail.com> - 2013-07-18 00:05 -0700
              Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Chris Angelico <rosuav@gmail.com> - 2013-07-18 17:13 +1000
                Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Aseem Bansal <asmbansal2@gmail.com> - 2013-07-18 00:29 -0700
                Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Chris Angelico <rosuav@gmail.com> - 2013-07-18 17:34 +1000
                Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Aseem Bansal <asmbansal2@gmail.com> - 2013-07-18 00:48 -0700
                Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Chris Angelico <rosuav@gmail.com> - 2013-07-18 17:52 +1000
                Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Aseem Bansal <asmbansal2@gmail.com> - 2013-07-18 01:10 -0700
                Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Chris Angelico <rosuav@gmail.com> - 2013-07-18 18:37 +1000
                Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) aseem bansal <aseembansal@ymail.com> - 2013-07-18 01:04 -0700
                Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Terry Reedy <tjreedy@udel.edu> - 2013-07-18 13:04 -0400
                Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Serhiy Storchaka <storchaka@gmail.com> - 2013-07-18 20:55 +0300
                Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Grant Edwards <invalid@invalid.invalid> - 2013-07-18 18:02 +0000
                Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Owen Marshall <o@owenmarshall.invalid> - 2013-07-18 18:19 +0000
                Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Michael Torrie <torriem@gmail.com> - 2013-07-18 16:40 -0600
                Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Owen Marshall <o@owenmarshall.invalid> - 2013-07-19 00:54 +0000
          Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Chris Angelico <rosuav@gmail.com> - 2013-07-18 16:49 +1000
        Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Grant Edwards <invalid@invalid.invalid> - 2013-07-18 13:00 +0000
        Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-07-19 11:25 +0000
          Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Chris Angelico <rosuav@gmail.com> - 2013-07-19 21:56 +1000
  Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) "Eric S. Johansson" <esj@harvee.org> - 2013-07-18 01:39 -0400
    Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Aseem Bansal <asmbansal2@gmail.com> - 2013-07-17 22:50 -0700
  Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Chris Angelico <rosuav@gmail.com> - 2013-07-18 16:15 +1000
  Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Michael Torrie <torriem@gmail.com> - 2013-07-18 16:34 -0600
  Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Jake Angulo <jake.angulo@gmail.com> - 2013-07-19 17:10 +1000
  Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project) Chris Angelico <rosuav@gmail.com> - 2013-07-19 17:17 +1000

csiph-web