문제

I'm having trouble with POP3 Client in delphi (indy). I can use some functionality only once after connecting to a POP3Server - the first time i type :

POP3Client.Connect

(with username, password, etc..) everything is just fine.But the second time I get message 'Already connected' and nothing like checkmessages, retrieveHeader, retrieve works.And if I try

POP3Client.Disconnect

it gives me an error 'Connection closed gracefully'. Can anyone help me with this ?

도움이 되었습니까?

해결책

Disconnect() sends a QUIT command to the server by default, which will fail if the connection has already been lost. If you are calling Disconnect() after a previous socket error occurred, pass false to the ANotifyPeer parameter of Disconnect() to bypass the QUIT command:

POP3Client.Disconnect(false);

Do note that bypassing the QUIT prevents the server from entering the UPDATE state, so if you had previously called Delete() then those messages will not be removed from the server, as deletion only occurrs during the UPDATE state. Use ANotifyPeer=false only during error handling, use ANotifyPeer=true during normal operation.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top