ConnectedEvent - WeOnlyDo Discussion board

ConnectedEvent (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Paul, Thursday, April 10, 2008, 12:10 (5869 days ago)

Hi,

can someone tell me how I use the sftp1.ConnectedEvent?
I need an Code-Example, the Example
Sftp1.ConnectedEvent += new WeOnlyDo.Client.SFTP.ConnectedDelegate(Sftp1_Connected); doesn't work...

Thanks.

Re: ConnectedEvent

by woddrazen, Thursday, April 10, 2008, 16:02 (5869 days ago) @ Paul

Hi Paul,


Did you maybe try our samples which comes with wodSFTP.NET? You can find it in component Samples folder. We have samples for C# and in samples Events are implemented.

Basically you should type: Sftp1.ConnectedEvent += and hit tab key twice and Event will be created.

Let us know how it goes.


Regards,
Drazen

Re: ConnectedEvent

by Paul, Friday, April 11, 2008, 11:25 (5868 days ago) @ woddrazen

Hi,

thanks! Now it works:-)

delegate void ConnectedEventCallback(object Sender, WeOnlyDo.Client.SFTP.ConnectedArgs Args);

private void sftp1_ConnectedEvent(object Sender, WeOnlyDo.Client.SFTP.ConnectedArgs Args)
{
if (this.textBox2.InvokeRequired)
{
ConnectedEventCallback d = new ConnectedEventCallback (sftp1_ConnectedEvent);
this.Invoke(d, new object[] { Sender, Args });
}
else
{if (Args.Error == null)
{
textBox1.Text=
***CONNECTED!! ;
}
else
textBox1.Text= Args.Error.Message;
}
}

Now I get the information, that a connection can not established:-(
It works with WinSCP... Protocol-extract:

2008-04-09 15:21:15.359 Session name: myUser@myPC
. 2008-04-09 15:21:15.359 Host name: 222.20.146.238 (Port: 22)
. 2008-04-09 15:21:15.359 User name: myUser (Password: Yes, Key file: No)
. 2008-04-09 15:21:15.359 Transfer Protocol: SFTP
. 2008-04-09 15:21:15.359 SSH protocol version: 2; Compression: No
. 2008-04-09 15:21:15.359 Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2008-04-09 15:21:15.359 Ciphers: aes,blowfish,3des,WARN,des; Ssh2DES: No
. 2008-04-09 15:21:15.359 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2008-04-09 15:21:15.359 SSH Bugs: -,-,-,-,-,-,-,-
. 2008-04-09 15:21:15.359 SFTP Bugs: -,-,-
. 2008-04-09 15:21:15.359 Proxy: SOCKS4
. 2008-04-09 15:21:15.359 HostName: proxy.XXXXX.net (Port: 1080); Username: ; Passwd: No
. 2008-04-09 15:21:15.359 Return code variable: Autodetect; Lookup user groups: Yes
. 2008-04-09 15:21:15.359 Shell: default, EOL: 0
. 2008-04-09 15:21:15.359 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2008-04-09 15:21:15.359 Cache directory changes: Yes, Permanent: Yes
. 2008-04-09 15:21:15.359 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2008-04-09 15:21:15.359 Alias LS: No, Ign LS warn: Yes, Scp1 Comp: No
. 2008-04-09 15:21:15.359 --------------------------------------------------------------------------
. 2008-04-09 15:21:15.375 Looking up host 222.20.146.238
. 2008-04-09 15:21:15.390 Connecting to 180.44.255.130 port 1080
. 2008-04-09 15:21:15.765 Server version: SSH-1.99-OpenSSH_4.3
. 2008-04-09 15:21:15.765 We claim version: SSH-2.0-WinSCP_release_3.8
. 2008-04-09 15:21:15.765 Using SSH protocol version 2
. 2008-04-09 15:21:19.531 Initialised AES-256 client->server encryption
. 2008-04-09 15:21:19.531 Initialised HMAC-SHA1 client->server MAC algorithm
. 2008-04-09 15:21:19.531 Initialised AES-256 server->client encryption
. 2008-04-09 15:21:19.531 Initialised HMAC-SHA1 server->client MAC algorithm
! 2008-04-09 15:21:19.906 Verwende Benutzername myUser .
. 2008-04-09 15:21:21.218 Keyboard-interactive authentication refused
. 2008-04-09 15:21:21.218 Session password prompt (myUser@222.20.146.238's password: 'XXXX' )
. 2008-04-09 15:21:21.218 Sent password
. 2008-04-09 15:21:21.609 Access granted
. 2008-04-09 15:21:22.750 Opened channel for session
. 2008-04-09 15:21:23.484 Started a shell/command
. 2008-04-09 15:21:23.484 --------------------------------------------------------------------------

Re: ConnectedEvent

by wodDamir, Friday, April 11, 2008, 11:39 (5868 days ago) @ Paul

Hi Paul,

Are you using proxy for connecting to web? From the WinSCP log i see that you use proxy to connect.

Please connect Proxy settings for wodSFTP.Net before connecting. It should work afterwards. you need to set ProxyType, ProxyHostname, ProxyPort and ProxyLogin and ProxyPassword properties (if your proxy requires authentication).

Can you try please?

Regards,
Damba

Re: ConnectedEvent

by Paul, Friday, April 11, 2008, 12:35 (5868 days ago) @ wodDamir

This is my Code, do you see any Problems?

sftp1 = new SFTP();
this.sftp1.ConnectedEvent += new WeOnlyDo.Client.SFTP.ConnectedDelegate(this.sftp1_ConnectedEvent);
sftp1.ProxyHostname = 180.44.255.130 ;
sftp1.ProxyLogin = XXXX ;
sftp1.ProxyPassword = XXXX ;
sftp1.ProxyPort = 1080;
sftp1.ProxyType = SFTP.ProxyTypes.ProxySocks4;
sftp1.Authentication = SFTP.Authentications.Password;
sftp1.Login = myUser ;
sftp1.Password = XXXX ;
sftp1.Connect( 222.20.146.238 ,22);

Re: ConnectedEvent

by wodDamir, Friday, April 11, 2008, 12:46 (5868 days ago) @ Paul

Paul,

The code looks ok to me. It still doesn't work?

What error do you receive in Connected Event? Can you please check Args for Error?

Regards,
Damba

Re: ConnectedEvent

by Paul, Friday, April 11, 2008, 12:56 (5868 days ago) @ wodDamir

The Error-Message is Cannot access a disposed object.
Object name: '.'.

Wrong password or what do you think?

Re: ConnectedEvent

by wodDamir, Friday, April 11, 2008, 13:00 (5868 days ago) @ Paul

Paul,

Where exactly do you get that error in debugger?

It looks like you're trying to access a proeprty of object that was already destroyed.

Can you try one of our samples with the same settings, do they work?

Regards,
Damba

Re: ConnectedEvent

by Paul, Friday, April 11, 2008, 13:18 (5868 days ago) @ wodDamir

So I tested it with the Sample-Application . Now the Error-Massage is:
***CONNECTING...
State changed to Connecting
from Disconnected
State changed to Disconnected
from Connecting
Error: Timeout occured due to inactivity

Re: ConnectedEvent

by wodDamir, Friday, April 11, 2008, 13:33 (5868 days ago) @ Paul

Paul,

Is there any chance we could connect to that server?

If that's possible, you can send any sensitive information to techsupport@weonlydo.com

Also, what server are you connecting to? Can you do Telnet your_server 22 and tell me what the first line returned?

Regards,
Damba

Re: ConnectedEvent

by robert, Wednesday, May 21, 2008, 09:14 (5828 days ago) @ wodDamir

Interested in the outcome of this topic as I'm having the same problem. My code is almost identical to Paul's and I'm using SSH Tectia server. I am not able to provide access to the server in question.

Re: ConnectedEvent

by wodDamir, Wednesday, May 21, 2008, 09:21 (5828 days ago) @ robert

Hi Robert,

First of all, what version of the component are you using?

Can you try connecting there using our sample applications? Does that work?

Do you use Proxy? Did you set the Proxy related properties?

Do you have FireWall on? Can you try disabling it?

Regards,
Damba

Re: ConnectedEvent

by robert, Wednesday, May 21, 2008, 09:31 (5828 days ago) @ wodDamir

I've set blocking = true. When I hit the connect() statement, control goes away and does not return until the connection is closed by the server.

The connection to the server is successful - this is confirmed by reviewing logs on the server - and the server closes the connection on timeout due to no activity.

I'm using version 3.04.20

Re: ConnectedEvent

by wodDamir, Wednesday, May 21, 2008, 09:39 (5828 days ago) @ robert

Robert,

And the ConnectedEvent does trigger?

Can you check the Args.Errorcode? Does it contain value?

Also, are you using any other Events?

Regards,
Damba

Re: ConnectedEvent

by robert, Wednesday, May 21, 2008, 09:56 (5828 days ago) @ wodDamir

The Connected event never fires.

The following events occur:
StateChangedEvent: State changed from Disconnected to Connecting
StateChangedEvent: State changed from Connecting to Disconnected
DisconnectedEvent: Disconnected

The server logs show the following events:
410 Login_success
..
420 Session_channel_open
421 Session_channel_close
412 Logout Idle timeout exceeded. Local disconnect
402 Disconnect. Reason. by Application Idle timeout exceeded. Local disconnect

The timeout value I'm using is 300 but the connection times out after about 2 minutes.

Re: ConnectedEvent

by wodDamir, Wednesday, May 21, 2008, 10:32 (5828 days ago) @ robert

Robert,

Can you please try updating to the latest version and try it out?

Also, you can connect to that server using other clint, i.e. FileZilla?

Regards,
Damba

Re: ConnectedEvent

by robert, Wednesday, May 21, 2008, 21:14 (5828 days ago) @ wodDamir

Damba,

I have uncovered evidence that the problem is not with my client but with the server.

Thanks for your help - I hope I won't need to call on you again!

Regards,
Robert