Best practices interfacing to device with Python's asyncio and pyserial-asyncio

2017-04-03 Thread Malte Forkel
Hello, I have written a Python package to read from and write to a serial device that uses short telegrams to communicate with sensors and actuators. My classes include one to model the transceiver (it establishes the serial connection using serial.aio.create_serial_connection) and one for the tel

Re: How to determine whether client and server are on the same host

2013-11-27 Thread Malte Forkel
Am 27.11.2013 00:15, schrieb Chris Angelico: > Since the server runs Linux, inability to run /sbin/ifconfig could > safely be interpreted as "we're not running on the server". But I > think this actually gains little over "is there a file called > /tmp/_this_is_malte_forkel_on_his_server_9515343_",

Re: How to determine whether client and server are on the same host

2013-11-27 Thread Malte Forkel
Am 27.11.2013 01:14, schrieb Michael Torrie: > > I believe socket.getsockname() can return the IP address of the > connecting client if you're using standard tcp/ip sockets. > The way you describe it, it sounds like it would require a change to the server. I can only modify the client. I'll try t

Re: How to determine whether client and server are on the same host

2013-11-27 Thread Malte Forkel
Am 27.11.2013 00:37, schrieb Gregory Ewing: > > What would happen if you tried the file-based method when > it wasn't a local connection? Is there a danger of it > "succeeding" on the wrong machine and damaging something? > I have been thinking about that. There is a slight risk that the client m

Re: How to determine whether client and server are on the same host

2013-11-26 Thread Malte Forkel
Am 26.11.2013 13:26, schrieb Chris Angelico: > If you deliberately create a file with a random name, the chances of > one existing with the same name on the client are infinitesimal unless > someone's deliberately trying to confuse things... in which case I > wouldn't worry about it. > I wouldn't,

Re: How to determine whether client and server are on the same host

2013-11-26 Thread Malte Forkel
Am 26.11.2013 12:38, schrieb Chris Angelico: > There is another way you might be able to do this. The server could > simply create a cookie in the file system - say, a file in /tmp with a > randomly-generated name - and it can announce that to the client. If > the client sees the same file in what

Re: How to determine whether client and server are on the same host

2013-11-26 Thread Malte Forkel
Am 26.11.2013 00:41, schrieb Ben Finney: > > On Unix, this is up to the person invoking the program: the “sockets > facility allows for a host-local connection to appear as though it's > going over a network. > > https://en.wikipedia.org/wiki/Localhost> > https://en.wikipedia.org/wiki/Un

Re: How to determine whether client and server are on the same host

2013-11-26 Thread Malte Forkel
Am 26.11.2013 00:07, schrieb Chris Angelico: > > Two easy ways you could do this. I would be inclined to do what > PostgreSQL and others do, and have an explicit indication that you > want to use a local method: for instance, the name "localhost". Use of > anything else (including "127.0.0.1") mea

How to determine whether client and server are on the same host

2013-11-25 Thread Malte Forkel
Hi, I have a Python application that communicates with a server via telnet. Host and port of the server are supplied by the user when the application is started. How can I determine from within the application whether the server's host actually is the local host? (In that case I could implement a

Re: Re-using copyrighted code

2013-06-09 Thread Malte Forkel
Am 10.06.2013 07:31, schrieb Steven D'Aprano: > > But bringing it back to the original topic, I believe that the philosophy > of FOSS is that we should try our best to honour the intentions of the > writer, not to find some legal loophole that permits us to copy his or > her work against their

Re: Re-using copyrighted code

2013-06-09 Thread Malte Forkel
I have asked the PSF for help regarding the implications of the license status of code from sre_parse.py and the missing license statement in sre.py. I'll happily report their answer to the list I they don't reply in this thread. At least partially, my confusion seems to be caused by the dichotom

Re-using copyrighted code

2013-06-08 Thread Malte Forkel
Hello, I have written a small utility to locate errors in regular expressions that I want to upload to PyPI. Before I do that, I would like to learn a litte more about the legal aspects of open-source software. What would be a good introductory reading? Plus, I have one very specific question: I

Utility to locate errors in regular expressions

2013-05-24 Thread Malte Forkel
Finding out why a regular expression does not match a given string can very tedious. I would like to write a utility that identifies the sub-expression causing the non-match. My idea is to use a parser to create a tree representing the complete regular expression. Then I could simplify the expressi

Python for embedded devices?

2007-11-19 Thread Malte Forkel
I would like to use Python on a router, an Edimax BR-6104K, running OpenWrt (http://www.openwrt.org). While I probably won't need most of the fancier stuff in Python, serial I/O and threads should be supported. The router is based on the ADM5120P, has 2MB of flash and 16MB of RAM, so the versi