How to connect in C# via vralib to work just like the sfxcl.exe command line works
Summary: SFXCL.EXE command line works, but C# code calling the client pack does not. What more is needed to get this retrieval to work? Does SFXCL.EXE figure out proxy information that the vralib.Connection object doesnít do automatically?
Iíve got a remote server to which Iím connecting using the following batch file (names and passwords changed). This runs successfully from a scheduled task using local machine credentials (MY_MACHINE_NAME\localusername). The retrieval crosses some firewalls and traverses domain boundaries along the way, but I have in no way configured sfxcl.exe for firewalls as far as I can recall. The batch file ONLY contains the following line.
sfxcl.exe /noprompt /move sftp://username:passwordBetterThanThis@Server.IP.Address.Here//server/path/* d:\MyLocalPath2\sftp\
The above command line works.
After installing the ClientPack, the following C# code executes and fails on the line above the comment. The debug file contents follow the sourcecode. I've changed the username, password and numbered IP address in this code sample.
vralib.License lic = new vralib.License();
vralib.Connection conn = new vralib.Connection();
vralib.FileTransferObject fto = new vralib.FileTransferObject();
string connectionString = "sftp://username:passwordBetterThanThis@Server.IP.Address.Here";
conn.DebugLevel = 99;
conn.DebugLogFile = @"D:\MyLocalPath1\logfilename.txt";
fto.SourcePath = "//server/path/*
fto.DestinationPath = @"D:\MyLocalPath2\sftp\";
Iíve run this service with the same credentials that sfxcl.exe is using in a Windows Service and I get the following results. The last line of code that executes is the Connect() call. I've tried running the service under the local machine identity that works from the command line and under a domain identity.
3/1/2012 9:17:12 PM,13672,6,[LOCAL] : SSH2Core version 22.214.171.1244 (init timing: 178 milliseconds)
3/1/2012 9:17:12 PM,13672,6,[LOCAL] : Connecting to Server.IP.Address.Here...
3/1/2012 9:17:12 PM,13672,6,[LOCAL] : Changing state from STATE_NOT_CONNECTED to STATE_EXPECT_KEX_INIT
3/1/2012 9:17:12 PM,13672,6,[LOCAL] : RECV: TCP/IP close
3/1/2012 9:17:12 PM,13672,6,[LOCAL] : RECV: OnRead(dwStatus=0x00000000)
3/1/2012 9:17:12 PM,13672,6,[LOCAL] : RECV: CloseTransport(rmp=0x00000000)
3/1/2012 9:17:12 PM,13672,6,[LOCAL] : Changing state from STATE_EXPECT_KEX_INIT to STATE_CLOSED
3/1/2012 9:17:12 PM,13672,6,[LOCAL] : Connected for 0 seconds, 13 bytes sent, 0 bytes received
I'I ran the installer of VanDyke Client pack on a Windows Server 2003 machine.
Last edited by jdev; 03-02-2012 at 10:06 AM.
|connect , firewall , sftp , vralib|
|Display Modes||Rate This Thread|