gpt4 book ai didi

java - NNTP 服务器实现

转载 作者:行者123 更新时间:2023-11-29 05:30:04 26 4
gpt4 key购买 nike

我正在尝试实现 nntp 服务器。但看起来我对多行响应有疑问。当我发送响应客户端关闭连接。我使用 Thunderbird 和 SeaMonkey 作为客户端。

我听取了帮助以了解我的回复有什么问题。谢谢。

[S] server
[C] client


[S] 200NNTP Service Ready,posting permitted.

[C] MODE READER
[S] 200 Posting allowed

[C] GROUP group1
[S] 221 1 10100 10100

[C] XOVER 10100-10100
[S] 224
[S] 10100
[S] Subject 2104406756
[S] User0 <user0@xxx.com>
[S] Tue Jan 28 11:32:44FET 2014
[S] <10100@xxx.com>
[S] .

[C] HEAD 10100
[S] 221 10100 <10100@xxx.com>
[S] Path: news.foo.bar!not-for-mail
[S] From: User0<user0@xxx.com>
[S] Newsgroups: group1
[S] Subject: Subject 2104406756
[S] Date: Tue Jan 28 11:32:44FET 2014
[S] Message-ID: <10100@xxx.com>
[S] .

更新1:

我在 Thunderbird 中安装了用于调试客户端流量的插件 (TBTracer),看起来客户端无法理解我的多行响应。客户端仅收到响应的第一部分。例如 XOVER 的响应是多行的。

[NNTP] [13:54:29] 200 NNTP Service Ready, posting permitted.

[NNTP] [13:54:29] MODE READER

[NNTP] [13:54:30] 200 Posting allowed

[NNTP] [13:54:30] GROUP group1

[NNTP] [13:54:31] 221 1 10100 10100

[NNTP] [13:54:31] XOVER 10100-10100

[NNTP] [13:55:15] 224

[NNTP] [13:55:15] QUIT

根据 RFC 3977 :

3.1.1. Multi-line Data Blocks

  1. The block consists of a sequence of zero or more "lines", eachbeing a stream of octets ending with a CRLF pair. Apart fromthose line endings, the stream MUST NOT include the octets NUL,LF, or CR.

我尝试发送不同类型的线路但没有成功。例如:

String r = "224\r\n10100\r\n6 Oct 2000 04:38:40\r\n<10100@xxx.com>\r\n.\r\n";

最佳答案

答案很简单。 RFC 2980 :

Each line of output will be formatted with the article number,
followed by each of the headers in the overview database or the
article itself (when the data is not available in the overview
database) for that article separated by a tab character.

Where no data exists, a null field must be provided (i.e. the output will have two tab characters adjacent to each other).

示例:111\tSubject\tUser\tDate\t111\t\t

关于java - NNTP 服务器实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21425325/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com