[twsocket] pop3 component not ready
hi, i use a custom pop3 component in my program, and frome time to time i get this errormessage from the server: -ERR System temporarily unavailable, please try again later. on the next connect try i get the pop3 component not ready exception, even if i check for connected: function TMailAlert.CheckError:boolean; begin result := false; with fpop do if (errormessage '') then begin if assigned(FOnError) then FOnError(ErrorMessage); ClearErrorMessage; result := true; end; end; procedure TMailAlert.CheckNewMail; begin with FPop do if not Connected then begin Fbusy := true; ClearErrorMessage; Connect; end; end; procedure TMailAlert.Pop3ClientRequestDone; begin if (FPop.connected) and (CheckError) then begin FPop.quit; exit; end; ... what could be the cause that the component is not ready after the error ? TIA, retnyg ps. pop3prot.pas Version: 2.27 -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Simple TWSocket listener question
Hello: I'm still getting familiar with the low level functionality of the TWSocket underlying component, so please excuse my question if it sounds trivial. I'm trying to set up a simple tcp listener that accepts a single client connection and communicates with it. I am basing it off the TWSchat demo as it does pretty much what I need: - to accept a client - to keep listening while connected - to respond with a message when other clients connect The way I'm doing it (as per the demo) is to give the accepted socket handle to the client object if it is free in the OnSessionAvailable event: Procedure TSrvApp.Srv_ClientAvailable(Sender: TObject; Error: Word); Begin If (FCliSocket.State = wsConnected) Then Begin // we're busy, dismiss the connection FBusySocket.HSocket := FSrvSocket.Accept; FBusySocket.SendStr('Server busy, try again later.'+ #13#10); FBusySocket.CloseDelayed; End Else Begin // Accept the connection FCliSocket.HSocket := FSrvSocket.Accept; FCliSocket.LineMode := True; End; End; I've noticed that when this is done, the OnSessionConnected event of the client is never triggered. I thought this was unusual as I thought that FD_CONNECT (which ultimately triggers the event) comes after FD_ACCEPT. Or am I doing something wrong? -dZ. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] pop3 component not ready
[EMAIL PROTECTED] wrote: procedure TMailAlert.Pop3ClientRequestDone; begin if (FPop.connected) and (CheckError) then begin FPop.quit; exit; end; ... what could be the cause that the component is not ready after the error ? After sending command Quit you should receive a server response. When it's received you may either close or abort the connection yourself or wait until the server drops the connection. Anyway start next connection attempt only when you are not connected, means after SessionClosed fired. -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be