Network Gateway Interface
Network Gateway Interface
The Network Gateway Interface provides:
- the ability to test application networking code without use of sockets, threads or subprocesses
- clean separation of application code and low-level networking code
- a fairly simple inheritence free set of networking APIs
- an event-based framework that makes it easy to handle many simultaneous connections while still supporting an imperative programming style.
To learn more, see http://packages.python.org/zc.ngi/
- support IPv6
- Sending data faster than a socket could transmit it wasn’t handled correctly.
- zc.ngi.async listeners didn’t provide the real address when binding to port 0.
- If application code made many small writes, each write was sent individually, which could trigger Nagle’s algorithm.
- Connection objects have a new peer_address attribute, which is equivilent to calling getpeername() on sockets.
- Servers using unix-domain sockets didn’t clean up socket files.
- When testing listeners were closed, handle_close, rather than close, was called on server connections.
- The zc.ngi.async connections’ write and writelines methods didn’t raise errors when called on closed connections.
- The built-in connection adapters and handy adapter base class didn’t implement __nonzero__.
When using zc.ngi.testing and a server sent input and closed a connection before set_handler was called on the client, the input sent by the server was lost.
By default, calling close on a connection could caause already written data not to be sent. Now, don’t close connections until data passed to write or writelines as, at least, been passed to the underlying IO system (e.g. socket.send).
(This means the undocumented practive of sending zc.ngi.END_OF_DATA to write is now deprecated.)
- Fixed a packaging bug.
There’s a new experimental zc.ngi.async.Implementation.listener option to run each client (server connection) in it’s own thread.
(It’s not documented. It’s experimental, but there is a doctest.)
- There was a bug in handling connecting to testing servers that caused printing handlers to be used when they shouldn’t have been.
- New improved documentation
- Support for writing request handlers in an imperative style using generators.
- Cleaner testing interfaces
- Refactored zc.ngi.async thread management to make the blocking APIs unnecessary. zc.ngi.async.blocking is now deprecated.
- Added support for running multiple async implementations in separate threads. This is useful in applications with fewer network connections and with handlers that tend to perform long-lating computations that would be unacceptable with a single select loop.
- Renamed IConnection.setHandler to set_handler.
- Dropped support for Python 2.4.
- The Sized request adapter’s writelines method was broken.
- There we a number of problems with error handling in the async implementation.
- Fixed bad logging of listening on .... The message was emitted before the actual operation was successful. Emits now a warning unable to listen on... if binding to the given address fails.
- Fixed a fatal win32 problem (socket.AF_UNIX usage).
- Removed impropper use of the SO_REUSEADDR socket option on windows.
- The sized adapter performed poorly (because it triggered Nagle’s algorithm).
- Spurious warnings sometimes occurred due to a race condition in setting up servers.
- Added missing “writelines” method to zc.ngi.adapters.Lines.
- zc.ngi.async bind failures weren’t handled properly, causing lots of annoying log messages to get spewed, which tesnded to fill up log files.
- The zc.ngi.async thread wasn’t named. All threads should be named.
- zc.ngi.blocking didn’t properly handle connection failures.
- Blocking input and output files didn’t properly synchronize closing.
- The testing implementation made muiltiple simultaneous calls to handler methods in violation of the promise made in interfaces.py.
- Async TCP servers used too low a listen depth, causing performance issues and spurious test failures.
- Added UDP support.
- Implementation responsibilities were clarified through an IImplementation interface. The “connector” attribute of the testing and async implementations was renamed to “connect”. The old name still works.
- Implementations are now required to log handler errors and to close connections in response to connection-handler errors. (Otherwise, handlers, and especially handler adapters, would have to do this.)
Server startups sometimes failed with an error like:
warning: unhandled read event warning: unhandled write event warning: unhandled read event warning: unhandled write event ------ 2007-05-30T22:22:43 ERROR zc.ngi.async.server listener error Traceback (most recent call last): File "asyncore.py", line 69, in read obj.handle_read_event() File "asyncore.py", line 385, in handle_read_event self.handle_accept() File "/zc/ngi/async.py", line 325, in handle_accept sock, addr = self.accept() TypeError: unpack non-sequence
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size zc.ngi-2.1.0.tar.gz (55.6 kB)||File type Source||Python version None||Upload date||Hashes View|