{"id":1942,"date":"2014-11-14T00:52:30","date_gmt":"2014-11-14T00:52:30","guid":{"rendered":"https:\/\/alt2.minisoft.com\/support\/?p=1942"},"modified":"2016-12-02T22:33:14","modified_gmt":"2016-12-02T22:33:14","slug":"nft-mdmft-using-host-command","status":"publish","type":"post","link":"https:\/\/alt2.minisoft.com\/support\/nft-mdmft-using-host-command\/","title":{"rendered":"NFT (MDMFT) &#8211; Using Host Command"},"content":{"rendered":"<p class=\"subheads\"><strong><span style=\"font-family: Arial;\">Using Host Command<\/span><\/strong><\/p>\n<p class=\"subheads\"><span style=\"font-family: Arial;\">This sample streams a job and waits for it to complete before downloading a file.<\/span><\/p>\n<pre>Option Explicit\r\n\r\nConst gcUpload = 0\r\nConst gcDownload = 1\r\nConst gcASCII = 0\r\nConst gcBinary = 1\r\n\r\nDim FTSession As Object\r\n\r\n<\/pre>\n<hr size=\"1\" \/>\n<pre>Private Sub cmdExit_Click()\r\n\r\nOn Error Resume Next\r\n\r\nIf FTSession.ConnectStatus = True Then\r\nFTSession.Disconnect\r\nEnd If\r\nSet FTSession = Nothing\r\nUnload Me\r\nEnd\r\n\r\nEnd Sub<\/pre>\n<hr size=\"1\" \/>\n<pre>Private Sub cmdStream_Click()\r\n\r\nDim ii As Integer\r\nDim TempStr As String\r\n\r\nOn Error GoTo Egress1\r\n\r\nScreen.MousePointer = 11\r\nStatusLine = \"Begin...\"\r\nSet FTSession = CreateObject(\"NetFT.Session\")\r\nStatusLine = \"Object Created - Request Connection...\"\r\nFTSession.HostAddress = \"204.250.148.132\"\r\nFTSession.Port = 30001\r\nFTSession.LoginUser = \"MGR\"\r\nTempStr = tPassword.Text\r\nIf (Len(TempStr) &gt; 1) Then\r\nFTSession.UserPassword = TempStr\r\nEnd If\r\nFTSession.LoginGroup = \"PUB\"\r\nFTSession.GroupPassword = \"\"\r\nFTSession.LoginAccount = \"MINISOFT\"\r\nFTSession.AccountPassword = \"\"\r\nFTSession.JobName = \"SAMPLE\"\r\nIf (Not FTSession.Connect) Then\r\nMsgBox \"1 - \" &amp; FTSession.ErrorMessage\r\nGoTo Egress1\r\nEnd If\r\nii = 0\r\nStatusLine = \"Connection Established - Logging on...\"\r\nFTSession.HostLogin\r\nTempStr = FTSession.LoginInfo\r\nIf (Len(TempStr) &lt;&gt; 24) Then\r\nMsgBox \"2 - \" &amp; FTSession.ErrorMessage\r\nGoTo Egress1\r\nEnd If\r\n\r\nCIERR = FTSession.HostCommand(\"PURGE \" &amp; tDLName)\r\nIf (CIERR &lt;&gt; 0) Then\r\nMsgBox (\"MPE Error\")\r\nEnd If\r\nCIERR = FTSession.HostCommand(\"PURGE \" &amp; tHFName)\r\nIf (CIERR &lt;&gt; 0) Then\r\nMsgBox (\"MPE Error\")\r\nEnd If\r\nCIERR = FTSession.HostCommand(\"BUILD \" &amp; tHFName)\r\nIf (CIERR &lt;&gt; 0) Then\r\nMsgBox (\"MPE Error\")\r\nEnd If\r\nCIERR = FTSession.HostCommand(\"STREAM \" &amp; tSTREAM)\r\nIf (CIERR &lt;&gt; 0) Then\r\nMsgBox (\"MPE Error\")\r\nEnd If\r\n\r\nTimer1.Interval = 1000\r\nGoTo Egress2\r\n\r\nEgress1:\r\nOn Error Resume Next\r\nMsgBox \"Error Exit\"\r\nIf FTSession.ConnectStatus = True Then\r\nFTSession.Disconnect\r\nEnd If\r\nSet FTSession = Nothing\r\nEgress2:\r\nStatusLine = \"Ready\"\r\nScreen.MousePointer = 0\r\n\r\nEnd Sub<\/pre>\n<hr size=\"1\" \/>\n<pre>Private Sub Timer1_Timer()\r\n\r\nDim TempStr As String\r\n\r\nOn Error GoTo Egress1\r\n\r\nTimer1.Interval = 0\r\nStatusLine = \"Checking...\"\r\nList1.Text = \"\"\r\nList1.Text = FTSession.HostFileList(tHFName)\r\nIf (Len(List1.Text) = 0) Then\r\nDownloadFile\r\nElse\r\nTimer1.Interval = 1000\r\nEnd If\r\n\r\nGoTo Egress2\r\n\r\nEgress1:\r\nOn Error Resume Next\r\nMsgBox \"Error Exit\"\r\nIf FTSession.ConnectStatus = True Then\r\nFTSession.Disconnect\r\nEnd If\r\nSet FTSession = Nothing\r\nEgress2:\r\nStatusLine = \"Ready\"\r\n\r\nEnd Sub<\/pre>\n<hr size=\"1\" \/>\n<pre>Private Sub DownloadFile()\r\n\r\nDim TempStr As String\r\n\r\nStatusLine = \"Transfering...\"\r\nFTSession.DisplayStats = True\r\nFTSession.Direction = gcDownload\r\nFTSession.ExistsAction = 1\r\nTempStr = tDLName.Text\r\nIf (Len(TempStr) &gt; 1) Then\r\nFTSession.LocalFile = TempStr\r\nEnd If\r\nTempStr = tDLName.Text\r\nIf (Len(TempStr) &gt; 1) Then\r\nFTSession.HostFile = TempStr\r\nEnd If\r\nFTSession.RecordSize = 80\r\nFTSession.TransferMode = gcASCII\r\nStatusLine = \"Logon Successful - Transfering...\"\r\nIf (FTSession.StartTransfer &lt;&gt; 0) Then\r\nMsgBox \"3 - \" &amp; FTSession.ErrorMessage\r\nGoTo Egress1\r\nEnd If\r\nStatusLine = \"Transfer Complete.\"\r\n\r\nGoTo Egress2\r\n\r\nEgress1:\r\nOn Error Resume Next\r\nMsgBox \"Error Exit\"\r\nIf FTSession.ConnectStatus = True Then\r\nFTSession.Disconnect\r\nEnd If\r\nSet FTSession = Nothing\r\nEgress2:\r\nStatusLine = \"Ready\"\r\nScreen.MousePointer = 0\r\n\r\nEnd Sub<\/pre>\n<hr noshade=\"noshade\" size=\"1\" \/>\n<pre>!JOB VBJOB2,MGR\/password.MINISOFT\r\n!CONTINUE\r\n!PURGE VBJOB3\r\n!COPY NPREADME,VBJOB3\r\n!PURGE VBJOB1\r\n!SET STDLIST=DELETE\r\n!EOJ<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Using Host Command This sample streams a job and waits for it to complete before downloading a file. Option Explicit Const gcUpload = 0 Const gcDownload = 1 Const gcASCII = 0 Const gcBinary = 1 Dim FTSession As Object Private Sub cmdExit_Click() On Error Resume Next If FTSession.ConnectStatus = True Then FTSession.Disconnect End If [&hellip;]<\/p>\n","protected":false},"author":75,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54,60],"tags":[],"_links":{"self":[{"href":"https:\/\/alt2.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/1942"}],"collection":[{"href":"https:\/\/alt2.minisoft.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alt2.minisoft.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alt2.minisoft.com\/support\/wp-json\/wp\/v2\/users\/75"}],"replies":[{"embeddable":true,"href":"https:\/\/alt2.minisoft.com\/support\/wp-json\/wp\/v2\/comments?post=1942"}],"version-history":[{"count":1,"href":"https:\/\/alt2.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/1942\/revisions"}],"predecessor-version":[{"id":1943,"href":"https:\/\/alt2.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/1942\/revisions\/1943"}],"wp:attachment":[{"href":"https:\/\/alt2.minisoft.com\/support\/wp-json\/wp\/v2\/media?parent=1942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alt2.minisoft.com\/support\/wp-json\/wp\/v2\/categories?post=1942"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alt2.minisoft.com\/support\/wp-json\/wp\/v2\/tags?post=1942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}