【问题标题】:Connect to localhost POP3 server through Thunderbird\Outlook通过 Thunderbird\Outlook 连接到 localhost POP3 服务器
【发布时间】:2017-04-16 06:23:25
【问题描述】:

尝试在 localhost(1024 端口)上连接到我自己的 POP3 服务器。其代码:

 server_socket = new ServerSocket(SBAP_PORT);
 Socket clntSocket = server_socket.accept();
 public void run() {
    try {
        try {
            in = new BufferedReader(
                    new InputStreamReader(socket.getInputStream()
                    ));
            out = new PrintWriter(socket.getOutputStream(), true);
            out.print("+OK\\r\\n");
            command = in.readLine();
            String result = handleInput(command);
            out.println(result);
        } finally {
            socket.close();
            state.close();
            System.out.println("client offline.");
        }
    } catch (Exception ignored) {
    }
}

使用 telnet 可以正常工作,但是当我尝试使用 Thunderbird 时,只是超时(无法找到您的电子邮件帐户的设置)。

在调试中我看到,我在连接时得到空字符串。

我做错了什么?也许我应该在连接后向客户发送一些东西?

【问题讨论】:

    标签: java server pop3


    【解决方案1】:

    我认为它必须是\r\n 而不是\\r\\n,另外尝试刷新您通过out.flush(); 发送给客户端的每个响应,但可能没有必要。

    【讨论】:

    • out.print("+OK\\r\\n") 和它都不起作用。服务器只是向我发送空字符串。我不知道,如果他想在实际接收命令之前从我这里发送一些东西......
    • 不,亲爱的,您应该将out.print("+OK\\r\\n"); 更改为out.print("+OK\r\n");,请再试一次@Xerocry
    猜你喜欢
    • 2016-08-08
    • 1970-01-01
    • 2016-04-19
    • 1970-01-01
    • 2011-04-13
    • 1970-01-01
    • 2012-05-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多