Net: PLT Networking Libraries

1`` | URLs and HTTP
2`` | URI Codec: Encoding and Decoding URIs
3`` | FTP: Client Downloading
4`` | Send URL: Opening a Web Browser
5`` | SMTP: Sending E-Mail
6`` | sendmail: Sending E-Mail
7`` | Headers: Parsing and Constructing
8`` | IMAP: Reading Mail
9`` | POP3: Reading Mail
10`` | MIME: Decoding Internet Data
11`` | Base 64: Encoding and Decoding
12`` | Quoted-Printable: Encoding and Decoding
13`` | DNS: Domain Name Service Queries
14`` | NNTP: Newsgroup Protocol
15`` | TCP: Unit and Signature
16`` | TCP Redirect: tcp^ via Channels
17`` | SSL Unit: tcp^ via SSL
18`` | CGI Scripts
19`` | Cookie: HTTP Client Storage
| Bibliography
| Index

On this page:

14.1`` Connection and Operations
communicator
connect-to-server
disconnect-from-server
open-news-group
authenticate-user
head-of-message
body-of-message
newnews-since
generic-message-command
make-desired-header
extract-desired-headers
14.2`` Exceptions
nntp
unexpected-response
bad-status-line
premature-close
bad-newsgroup-line
non-existent-group
article-not-in-group
no-group-selected
article-not-found
authentication-rejected
14.3`` NNTP Unit
nntp@
14.4`` NNTP Signature
nntp^

Version: 4.0.2
contents index
← prev up next →

### 14`` NNTP: Newsgroup Protocol

(require net/nntp)

The net/nntp module provides tools to access Usenet group via NNTP [RFC977].

#### 14.1`` Connection and Operations

(struct |  | communicator |  | (sender receiver server port))

sender : output-port?
receiver : input-port?
server : string?
port : (integer-in 0 65535)

Once a connection to a Usenet server has been established, its state is stored in a communicator, and other procedures take communicators as an argument.

(connect-to-server server [port-number]) → communicator?
server : string?
port-number : (integer-in 0 65535) = 119

Connects to server at port-number.

(disconnect-from-server communicator) → void?
communicator : communicator?

Disconnects an NNTP communicator.

(open-news-group communicator newsgroup)

→

exact-nonnegative-integer?
exact-nonnegative-integer?
exact-nonnegative-integer?

communicator : communicator?
newsgroup : string?

Selects the newsgroup of an NNTP connection. The returned values are the total number of articles in the group, the first available article, and the last available article.

(authenticate-user |  | communicator |  |  |  |
|  | username |  |  |  |
|  | password) |  | → |  | void?

communicator : communicator?
username : string?
password : string?

Tries to authenticate a user with the original authinfo command (uses cleartext). The password argument is ignored if the server does not ask for it.

(head-of-message |  | communicator |  |  |  |
|  | message-index) |  | → |  | (listof string?)

communicator : communicator?
message-index : exact-nonnegative-integer?

Given a message number, returns its header lines.

(body-of-message |  | communicator |  |  |  |
|  | message-index) |  | → |  | (listof string?)

communicator : communicator?
message-index : exact-nonnegative-integer?

Given a message number, returns the body of the message.

(newnews-since communicator message-index) → (listof string?)
communicator : communicator?
message-index : exact-nonnegative-integer?

Implements the NEWNEWS command (often disabled on servers).

((generic-message-command |  | command |  |  |  |
|  | ok-code) |  |  |  |
|  | communicator |  |  |  |
|  | message-index) |  | → |  | (listof string?)

command : string?
ok-code : exact-integer?
communicator : communicator?
message-index : exact-nonnegative-integer?

Useful primitive for implementing head-of-message, body-of-message and other similar commands.

(make-desired-header tag-string) → regexp?
tag-string : string?

Takes a header field’s tag and returns a regexp to match the field

(extract-desired-headers header desireds) → (listof string?)
header : (listof string?)
desireds : (listof regexp?)

Given a list of header lines and of desired regexps, returns the header lines that match any of the desireds.

#### 14.2`` Exceptions

(struct |  | (nntp exn) |  | ())

The supertype of all NNTP exceptions.

(struct |  | (unexpected-response nntp) |  | (code text))

code : exact-integer?
text : string?

Raised whenever an unexpected response code is received. The text field holds the response text sent by the server.

(struct |  | (bad-status-line nntp) |  | (line))

line : string?

Raised for mal-formed status lines.

(struct |  | (premature-close nntp) |  | (communicator))

communicator : communicator?

Raised when a remote server closes its connection unexpectedly.

(struct |  | (bad-newsgroup-line nntp) |  | (line))

line : string?

Raised when the newsgroup line is improperly formatted.

(struct |  | (non-existent-group nntp) |  | (group))

group : string?

Raised when the server does not recognize the name of the requested group.

(struct |  | (article-not-in-group nntp) |  | (article))

article : exact-integer?

Raised when an article is outside the server’s range for that group.

(struct |  | (no-group-selected nntp) |  | ())

Raised when an article operation is used before a group has been selected.

(struct |  | (article-not-found nntp) |  | (article))

article : exact-integer?

Raised when the server is unable to locate the article.

(struct |  | (authentication-rejected nntp) |  | ())

Raised when the server reject an authentication attempt.

#### 14.3`` NNTP Unit

(require net/nntp-unit)

nntp@ : unit?

Imports nothing, exports nntp^.

#### 14.4`` NNTP Signature

(require net/nntp-sig)

nntp^ : signature

Includes everything exported by the net/nntp module.

contents index
← prev up next →