用于连接到 NNTP 服务器的 java Socket 或 DatagramSocket
大家好,我想编写一个简单的 NNTP 客户端,它可以连接到服务器,发送 AUTHINFO 详细信息,并使用 GROUP 和 BODY 加入组并检索帖子。
我在这里与几个人进行了讨论,他们建议使用 dataGramSockets 和 datGramPackets。
谁能提供一个简单的脚本来解释每个命令的工作原理以及为什么使用 DataGram Sockets 而不是传统的 Sockets?我使用 Socket 并且能够连接到我的服务器,但我不知道如何使用 getInputStream() 和 getOutputStream() 向服务器发送/接收数据。
任何帮助都会很棒。
Hay Guys, i want to write a simple NNTP client, which can connect to a server, send AUTHINFO details, and use GROUP and BODY to join a group and retreive posts.
I had a discussion with a couple of guys in here and they suggested using dataGramSockets and datGramPackets.
Could anyone provide a simple script to do these explaining how each command works and why use DataGram Sockets over the tradtional Socket? I used Socket and was able to connect to my server, but i hadn't a clue how to use getInputStream() and getOutputStream() to send/receive data to the server.
Any help would be great.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
NNTP 不是基于 TCP 的协议吗?我认为数据报在这里不合适。有关详细信息,请参阅 RFC。使用此协议。
我看到 Apache Commons Net 提供 an NNTP包,可能有用。
如果有人已经完成了这项艰苦的工作,我会避免使用原始套接字。
Isn't NNTP a TCP-based protocol ? I don't think datagrams would be appropriate here. See the RFC for further info re. using this protocol.
I see that Apache Commons Net offer an NNTP package, which may be of use.
I'd avoid using raw sockets if someone has already done this hard work.