Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-02-2012, 08:45 AM
tomfromokaloosa tomfromokaloosa is offline
Registered User
 
Join Date: Mar 2012
Posts: 2
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?

Details:
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();

lic.AcceptEvaluationLicense();

string connectionString = "sftp://username:passwordBetterThanThis@Server.IP.Address.Here";
conn.DebugLevel = 99;
conn.DebugLogFile = @"D:\MyLocalPath1\logfilename.txt";
conn.Connect(connectionString);
//FAILS HERE

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 6.7.0.354 (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.
Reply With Quote
 

Tags
connect , firewall , sftp , vralib

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 05:49 AM.