Board index » delphi » Please help - Socket Error # 10060 Connection timed out

Please help - Socket Error # 10060 Connection timed out

Finn,
I have also started using Indy 9.0 recently.
Are you using a background process to listen on that port?
In that case 'Kill' that process and then try to connect to that port from your application.

Praveen Naregal

Quote
Finn Tolderlund <n...@spam.dk> wrote in message news:3dcf488f@newsgroups.borland.com...

I'm trying to switch from the FastNet components to Indy.
I'm using the TIdPOP3 component in Delphi 5 with the lastest Indy version
9.00.11 just downloaded from www.nevrona.com/indy.
But I keep getting a "Socket Error # 10060 Connection timed out" message.
I have narrowed the problem down to this little piece of code:

procedure TReceiveMailForm.Button4Click(Sender: TObject);
var
  IdPOP3: TIdPOP3;
  MesCount, MailBoxSize: Integer;
begin
  StatusMemo.Clear;
  AntalMessagesLabel.Caption := 'Messages: ';
  MailBoxSizeLabel.Caption := 'Mailbox size: ';
  IdPOP3 := TIdPOP3.Create(nil);
  try
    IdPOP3.OnStatus := IdPOP3Status;
    IdPOP3.Username := UsernameEdit.Text;
    IdPOP3.Password := PasswordEdit.Text;
    IdPOP3.Host := HostEdit.Text;
    IdPOP3.Port := StrToInt(PortEdit.Text);
    IdPOP3.Connect;
    MesCount := IdPOP3.CheckMessages;
    AntalMessagesLabel.Caption := 'Messages: ' + IntToStr(MesCount);
    MailBoxSize := IdPOP3.RetrieveMailBoxSize;
    MailBoxSizeLabel.Caption := 'Mailbox size: ' + IntToStr(MailBoxSize);
    IdPOP3.Disconnect;
  finally
    IdPOP3.Free;
  end;
end;

Now, this works fine the *first* time I click the button and the code is
executed.
The second time I get the message "Socket Error # 10060 Connection timed
out" after 20 seconds in the Connect procedure.
Why?

The same thing work without problems in Delphi 6 with the version of Indy
that came with Delphi 6.
(I have to change IdPOP3.Username to IdPOP3.UserID in Delphi 6).

And some more info:
If I modify the code a bit, just by adding the TIdAntiFreeze component in
the code in Delphi 5 then it also works without problems when calling the
code several times.
Like this:
procedure TReceiveMailForm.Button5Click(Sender: TObject);
var
  IdPOP3: TIdPOP3;
  IdAntiFreeze: TIdAntiFreeze;
  MesCount, MailBoxSize: Integer;
begin
  StatusMemo.Clear;
  AntalMessagesLabel.Caption := 'Messages: ';
  MailBoxSizeLabel.Caption := 'Mailbox size: ';
  IdPOP3 := TIdPOP3.Create(nil);
  IdAntiFreeze := TIdAntiFreeze.Create(nil);
  try
    IdPOP3.OnStatus := IdPOP3Status;
    IdPOP3.Username := UsernameEdit.Text;
    IdPOP3.Password := PasswordEdit.Text;
    IdPOP3.Host := HostEdit.Text;
    IdPOP3.Port := StrToInt(PortEdit.Text);
    IdPOP3.Connect;
    MesCount := IdPOP3.CheckMessages;
    AntalMessagesLabel.Caption := 'Messages: ' + IntToStr(MesCount);
    MailBoxSize := IdPOP3.RetrieveMailBoxSize;
    MailBoxSizeLabel.Caption := 'Mailbox size: ' + IntToStr(MailBoxSize);
    IdPOP3.Disconnect;
  finally
    IdPOP3.Free;
    IdAntiFreeze.Free;
  end;
end;

Is this a bug in Indy 9.00.11 ?
Is it supposed not to work without IdAntiFreeze?

I'm new to Indy so I'm a bit confused about this.
Can anyone shed some light on this for me?

Thanks in advance,
Finn Tolderlund

 

Re:Please help - Socket Error # 10060 Connection timed out


No I'm not using that.
Thanks for your reply.

The problem still is:
Indy 9.0 do not work, unless I use the TIdAntiFreeze component.
Indy 8 that comes with Delphi 6 works fine without the TIdAntiFreeze
component.
Why this difference?
Is it a bug in Indy 9.0?
Can someone else confirm this difference?
--
Finn Tolderlund

Quote
"Praveen Naregal" <pgnare...@yahoo.com> wrote in message

news:3dcf5744@newsgroups.borland.com...
Quote
> Finn,
> I have also started using Indy 9.0 recently.
> Are you using a background process to listen on that port?
> In that case 'Kill' that process and then try to connect to that port from
your application.

> Praveen Naregal

> Finn Tolderlund <n...@spam.dk> wrote in message

news:3dcf488f@newsgroups.borland.com...
Quote
> I'm trying to switch from the FastNet components to Indy.
> I'm using the TIdPOP3 component in Delphi 5 with the lastest Indy version
> 9.00.11 just downloaded from www.nevrona.com/indy.
> But I keep getting a "Socket Error # 10060 Connection timed out" message.

Re:Please help - Socket Error # 10060 Connection timed out


I had some problems with Indy 9 so I went back to Indy 8. I can not tell you
if they changed how it works or if it is a bug. Looks like a bug though.

Thanx,
Giuliano

Other Threads