Connect event not firing - WeOnlyDo Discussion board

Connect event not firing (General questions)

by Ryan Hafey, Wednesday, June 21, 2006, 09:31 (6730 days ago)

Hi,
I have a windows NT service which is using the wodSSHCom object inside a thread to connect to a telnet server.
This works the first time i attempt to connect, but if i destroy the object and then recreate it, it then hangs when i call the connect method.
However, as a test i stumbled upon the following.If i make two instances and set the blocking property of the first instance it works ok.

eg.

//removing the next two lines make the app hang when calling connect
FTelnet2 := TwodSSHCom.Create( nil );
FTelnet2.Blocking := true;

FTelnet := TwodSSHCom.Create( nil );
FTelnet.OnConnected := wodSSH1Connected;
FTelnet.KeepAlives := 0;
FTelnet.Timeout := 0;
FTelnet.Blocking := true;
FTelnet.StripANSI := true;
FTelnet.Connect( '***' , 23);

I have added some logging, and the connected event never fires. If i set the timeout to anything above 0, it timeouts but never connects.

This is a really bisazre type probably, which setting the blocking blocking property on a dummy object seems to resolve (i dont actually do anything with the dummy object, but if i free it, then the connect methods starts hanging again).

Anyone have any suggestions?

Thanks.


Re: Connect event not firing

by wodDamir, Wednesday, June 21, 2006, 11:32 (6730 days ago) @ Ryan Hafey

Hi Ryan,

Please give me some time to test this. We will inform you as soon as we make any progress.

Regards,
Damir

Re: Connect event not firing

by wodDamir, Wednesday, June 21, 2006, 16:03 (6729 days ago) @ wodDamir

Ryan,

I just tested it in VB6, and it worked for me. What i did is test with following code the way you described in your sample:
----------------------------------
Set wodTelnet1 = New wodSSHCom
wodTelnet1.KeepAlives = 0
wodTelnet1.Timeout = 0
wodTelnet1.Blocking = True
wodTelnet1.StripANSI = True
wodTelnet1.HostName = my_hostname
wodTelnet1.Login = my_login
wodTelnet1.Password = my_password
wodTelnet1.Port = 23
wodTelnet1.Connect
----------------------------------

I put a msgbox into the Connected Event to see if the Event will be triggered, and I also created another instance of the object, and didn't encounter any problems.

Could you maybe provide me with a small sample for delphi so i could test the exact same thing that happens to you?