Remote Server
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Thread: Remote Server

  1. #1
    Join Date
    May 2012
    Posts
    4

    Remote Server

    Hi
    Im trying to comunicate with a FTP server,where i want to execute a program,but i don`t know how.
    I tryed with psexec..something like this

    Code:
    Dim command As String
    command = Shell("CMD.exe")
    Dim systemName As String
    systemName = "IP" 'Here im using the IP'
    Shell("psexec \\" & systemName & command)
    But cmd.exe is opening on my computer..is the first time when im using psexec and i don`t know how..and im not an advanced.

    Sorry for my bad english.

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,987

    Re: Remote Server

    Use Windows Explorer, type FTP:// and the address of the FTP Server
    It will prompt you for the user name/password, and you can remember it.

    I have a CMD script that opens the site, I drag a file, and close it for the week.

    Works fine.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    May 2012
    Posts
    4

    Re: Remote Server

    Quote Originally Posted by dglienna View Post
    Use Windows Explorer, type FTP:// and the address of the FTP Server
    It will prompt you for the user name/password, and you can remember it.

    I have a CMD script that opens the site, I drag a file, and close it for the week.

    Works fine.
    No like that,i wan`t to make a program and when you run it,on that ftp server is runing another program and is register something,and i will know who runned the program,let`s say i want to do it for another pc not for ftp..
    How to do it?

  4. #4
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Remote Server

    only solution is to download it from the FTP server, and then run it from the local drive...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  5. #5
    Join Date
    May 2012
    Posts
    4

    Re: Remote Server

    But psexec is only for Lan connections?
    The program will be on my site and downloaded by users..and when will run it to run cmd.exe and a 'command' on another pc..

  6. #6
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Remote Server

    FTP: is a File server... It is like having a External HDD , Flash stick or memory card..

    YOU CANNOT EXECUTE any code on the Server via FTP.. It is not designed for this, does not allow this and will never do this, ever....

    Download and execute from temp folder.
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  7. #7
    Join Date
    May 2012
    Posts
    4

    Re: Remote Server

    Ok,let`s say i wan`t to execute on a pc,please give me an example.

  8. #8
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Remote Server

    Use a FTP Batch Script to download the file then you can use
    Code:
    Shell("File.exe")
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  9. #9
    Join Date
    Dec 2008
    Location
    Step Into(F11)
    Posts
    465

    Talking Re: Remote Server

    Im trying to comunicate with a FTP server,where i want to execute a program,but i don`t know how.
    what y want to perform with ftp ?download some files from ftp .upload on ftp or something other ?let me know very exactly .


    Use a FTP Batch Script to download the file then you can use
    use this method .try the following way .i have been using in hundreds of application .we are no one retail company in Kuwait city .go through the following way .
    Code:
    Public Function DownloadFile() As Boolean
     Dim strMsg$
     Dim strLine$
     Dim gstrMessage$
     Dim processID#
     Dim process_handle#
     Dim zipapfilepath$
    Dim BatchPathLoc As String
     Dim DownloadFilepath$
    Dim FTPCommandList As String
     '------------------------ Authentication--------------------------
    DownloadFilepath = "\Inditexx\Download"
    Call CheckInditexFolder(DownloadFilepath)
    FTPCommandList = strDwnldFilePth & "\FTPCommandList.txt"
    Open FTPCommandList For Output As #1
     strLine = ""
     strLine = "USERNAME" & vbCrLf & _
     "PASSWORD" & vbCrLf & _
     "ascii" & vbCrLf & _
     "prompt off" & vbCrLf & _
     "cd /outgoing/articles/" & vbCrLf & _
     "mget ART*.ZIP" & vbCrLf & _
     "close" & vbCrLf & _
     "bye" & vbCrLf
     Print #1, strLine
     Close #1
    BatchPathLoc = strDwnldFilePth & "\FTPDownBatchFile.bat"
     Open BatchPathLoc For Output As #1
     strLine = ""
     strLine = "C:" & vbCrLf & _
     "cd " & DownloadFilepath & vbCrLf & _
     "C:\WINDOWS\system32\ftp.exe -s:" & FTPCommandList & " ftp1.inditex.com" & vbCrLf
     Print #1, strLine
     Close #1
     '----------------------- Downloading Data with FTP ------------------------------
    processID = Shell(BatchPathLoc, vbHide)
     process_handle = OpenProcess(SYNCHRONIZE, 0, processID)
     'NOT NEEDED--->If process_handle <> 0 Then
     WaitForSingleObject process_handle, INFINITE
     CloseHandle process_handle
     'NOT NEEDED--->End If
     gstrMessage = gstrMessage & "Searching for files in <IN> folder" & vbCrLf
     'gstrMessageToUser = gstrMessageToUser & "Searching for files in <IN> folder" & vbCrLf
     '
     ' Use your own path instead of \projectFTPData or create this folder on your C drive
     '
     If Dir$("c:\Inditexx\Download" & "\ART*.ZIP") = "" Then
     strMsg = strMsg & "No files on FTP to download" & vbCrLf
     MsgBox strMsg
     Exit Function
     Else
     DownloadFile = True
     strMsg = strMsg & "Files Downloaded from FTP" & vbCrLf
     MsgBox strMsg
     End If
     End Function
      
     Public Sub CheckInditexFolder(path As String)
     If Dir("C:\Inditexx", vbDirectory) = "" Then
         MkDir "C:\Inditexx"
      End If
         If Dir("C:\Inditexx\download", vbDirectory) = "" Then
              MkDir "C:\Inditexx\download"
         End If
     End Sub
    Last edited by firoz.raj; May 25th, 2012 at 05:49 AM.

  10. #10
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Remote Server

    Quote Originally Posted by firoz.raj View Post
    don't use this **** method .try the following way
    BE CAREFUL about your language and attitude on the forums..

    The AUP (Acceptable Use Policy) is Very Clear on this
    *You will not post any Content that is knowingly false, misleading, or inaccurate.
    *You will not behave in an abusive and/or hateful manner, and will not harass, threaten, nor attack anyone.
    *You will not use profanity
    The OP did say..
    Quote Originally Posted by TzAkS View Post
    ....
    but i don`t know how
    ......
    and im not an advanced.
    And your code is nothing more than an Overly advanced way of doing what was proposed.

    Lets look at it..
    Code:
    FTPCommandList = strDwnldFilePth & "\FTPCommandList.txt"
    Open FTPCommandList For Output As #1
     strLine = "USERNAME" & vbCrLf & _
     "PASSWORD" & vbCrLf & _
     "ascii" & vbCrLf & _
     "prompt off" & vbCrLf & _
     "cd /outgoing/articles/" & vbCrLf & _
     "mget ART*.ZIP" & vbCrLf & _
     "close" & vbCrLf & _
     "bye" & vbCrLf
     Print #1, strLine
    This code creates a Text file for use as a FTP Batch file with all the commands that are needed by ftp..
    Code:
    BatchPathLoc = strDwnldFilePth & "\FTPDownBatchFile.bat"
     Open BatchPathLoc For Output As #1
     strLine = "C:" & vbCrLf & _
     "cd " & DownloadFilepath & vbCrLf & _
     "C:\WINDOWS\system32\ftp.exe -s:" & FTPCommandList & " ftp1.inditex.com" & vbCrLf
     Print #1, strLine
    Make a Batch command file to execute FTP.
    [code]processID = Shell(BatchPathLoc, vbHide)[/quote]
    Use Shell to execute the batch files....

    Hmmmm ... EXACTLY the same as was proposed... just made very complicated..

    and looking back at your comment, seems you Shot down the exact method your using anyway, so i have no idea how you can claim,
    Quote Originally Posted by firoz.raj View Post
    we are no one retail company in Kuwait city
    ...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center