Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #60286
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <newb@seehart.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.013 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'messages.': 0.05; 'advance': 0.07; 'classes.': 0.09; 'delimited': 0.09; 'derived': 0.09; 'hiding': 0.09; 'password)': 0.09; 'terminated': 0.09; 'python': 0.11; 'times,': 0.14; "'\\n').": 0.16; 'client:': 0.16; 'disconnect': 0.16; 'hides': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'server:': 0.16; 'sockets': 0.16; 'through.': 0.16; 'underlying': 0.16; 'all.': 0.16; 'basically': 0.19; 'seems': 0.21; 'bonus': 0.22; 'header:User- Agent:1': 0.23; 'sends': 0.24; 'equivalent': 0.26; 'host': 0.29; 'timely': 0.30; "i'm": 0.30; 'layer': 0.31; 'compatible': 0.32; 'run': 0.32; 'open': 0.33; '(i.e.': 0.33; 'implemented': 0.33; 'plain': 0.33; 'there,': 0.34; "can't": 0.35; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'subject:Simple': 0.36; 'thanks': 0.36; 'should': 0.36; 'list': 0.37; 'starting': 0.37; 'server': 0.38; 'to:addr:python-list': 0.38; 'anything': 0.39; 'does': 0.39; 'use.': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'course.': 0.60; 'logs': 0.60; 'simple': 0.61; 'complete': 0.62; 'such': 0.63; 'header:Reply-To:1': 0.67; 'messaging': 0.68; 'user,': 0.69; 'reply-to:no real name:2**0': 0.71; 'manner': 0.72; 'million': 0.74; 'browser.': 0.78; 'asynchronous': 0.84; 'atomic': 0.84; 'common,': 0.84; 'hood': 0.84; 'received:192.168.1.21': 0.84; 'browse': 0.95 |
| Date | Sat, 23 Nov 2013 01:27:23 -0800 |
| From | Padawan Learner <newb@seehart.com> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 |
| MIME-Version | 1.0 |
| To | Python mailing list <python-list@python.org> |
| Subject | Simple TCP message framework |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Mailman-Approved-At | Sat, 23 Nov 2013 10:29:55 +0100 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | newb@seehart.com |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3077.1385198997.18130.python-list@python.org> (permalink) |
| Lines | 40 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1385198997 news.xs4all.nl 16007 [2001:888:2000:d::a6]:33049 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:60286 |
Show key headers only | View raw
Seems like the following pattern must be very common, solved a million
times, but I can't seem to find anything this simple and ready to use.
Basically I just want a simple python messaging layer that hides some of
the messiness of the underlying sockets and user authentication. It
would be asyncore under the hood of course.
Perhaps what I am looking for is hiding in plain sight, but there are so
many asynchronous communication tools out there, it's hard to thumb
through them all. So I'm not looking for such a list of toolkits to
browse through. Just something simple that does the equivalent of the
following:
Server:
on_open(user) - called when a user logs in
on_close(user) - called when a user disconnects
on_recv(user, s) - called when a user sends a message
send(user, s) - send a message to a user
Client:
open(host, user, password) - open an authenticated session with the
host
close() - disconnect
send(s) - send a message to the server
on_recv(s): called when a message is received from the server
Methods starting with "on_" are callbacks intended to be implemented by
derived classes.
Messages are atomic and delimited by '\n'. So concatenation of buffered
messages is hidden. A message is received when complete (i.e. terminated
with '\n'). Also, each message should be implicitly flushed, so that it
will be received in a timely manner in the absence of additional messages.
Extra bonus for a compatible javascript implementation of the Client as
well, so it can run in a browser.
Thanks in advance for any thoughts.
- Padawan
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Simple TCP message framework Padawan Learner <newb@seehart.com> - 2013-11-23 01:27 -0800
csiph-web