Reputation: 79
Trying to connect to my own POP3 server on localhost(1024 port). Its code:
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) {
}
}
It's working fine with telnet, but when I try to do it with Thunderbird, just get timeout(Failed to find settings for your email account).
In debug I see, that I get null string while connecting.
What am I doing wrong? Maybe I should send something to client just after connecting?
Upvotes: 0
Views: 142
Reputation:
I think it must be \r\n
rather \\r\\n
, plus try to flush for each response you send to the client by out.flush();
, but it might not be necessary.
Upvotes: 1