This is a library for communicating with NNTP (network news transport protocol). It also aims to support more protocols. This library is very much work in progress.
This library offers a framework for writing general request/response types of protocols.
This class offers support for general protocol support. It has the following public methods.
Creates a new connection to host
+HostV at port
true, the connection will be reopened if it's lost.
Processes a list of queries.
Processes a single query. Both of these methods take records with arguments passed in bound fields and replies passed in unbound ones. All replies have the field
status in common with them. Common replies for this are atoms
ok, for success, and
closed, for a closed connection. A closed connection cannot be reopened; create a new connection if you want it.
Closes the connection.
Returns the amount of bytes read by this connection so far. This is a list, with the tail bound when more bytes are read.
Returns the amount of bytes written so far. Similar to
Protocol.protocol has also the following features.
Host address this protocol object is connected to.
Protocol.protocol can be subclassed. It has some additional methods for this use and requires a few methods.
Send the text message
+V to the host. If
+R is not nil, it is passed to the client's port.
+R to the client from the parser.
+R to the parser from the client.
This method has to be defined when implementing new protocols.
+S is a list of characters received from the host. The parser typically communicates with the client with
parserMsg. When the stream is closed, the parser has to call
parserMsg(closed). This method will call itself recursively until the connection is closed.
Also, the method
request has to be defined by the subclass.