displaying all cmd.exe text to textbox - vb.net

I've search high and low looking for a way to display all text from FTP.exe to a richtextbox. so far i've only been able to do is display the output code. the idea is to run the test and display and capture to a file which hasn't been a problem except i can't seem to display all text as you would see it in Command.Hoping to see all text when done. Please Help!!
Here is he code:
Private Sub Rectangle1_Click(sender As Object, e As EventArgs) Handles Rectangle1.Click
Dim p As New Process()
With p
.StartInfo.Arguments = " -s:c:\dsl\ftptest\speed1.txt 65.40.220.20"
.StartInfo.CreateNoWindow = True
.StartInfo.FileName = "ftp"
.StartInfo.RedirectStandardError = True
.StartInfo.RedirectStandardOutput = True
.StartInfo.UseShellExecute = False
.Start()
Dim StErr As StreamReader = .StandardError
Dim StOut As StreamReader = .StandardOutput
While (Not StOut.EndOfStream)
Me.RichTextBox1.AppendText(String.Format("{0}", StOut.ReadLine() & vbCrLf))
End While
.WaitForExit()
End With
End Sub
End Class
Here is the output from the code:
User (65.40.220.20:(none)): Hash mark printing On ftp: (2048 bytes/hash mark) .
hash
get test.1meg
#
cd upload
put test.1meg
#
close
bye
Here is What I'm looking for:
C:\DSL\FTPTEST>call FTP -s:c:\dsl\FTPtest\speed1.txt 65.40.220.20
Connected to 65.40.220.20.
220-
This server is provided as a EMBARQ Speedtest server for DSL customers only.
Any other use is prohibited.
You may login using anonymous ftp and download the test files to determine your speed.
You may upload the same files to the upload directory to test your upload speed.
You may only upload the files that you previously downloaded from this server.
You cannot download anything from the upload directory.
Remember, some ftp programs measure speed in bytes per second.
DSL speeds are measured in bits per second. There are 8 bits in a byte.
If you can download at 64 kilobytes per second then that is the same as
512 kilobits per second.
220 65.40.220.20 FTP server ready
User (65.40.220.20:(none)):
331 Anonymous login ok, send your complete email address as your password.
230-
This server is provided as a EMBARQ Speedtest server for DSL customers only.
Any other use is prohibited.
You may login using anonymous ftp and download the test files to determine your speed.
You may upload the same files to the upload directory to test your upload speed.
You may only upload the files that you previously downloaded from this server.
You cannot download anything from the upload directory.
Remember, some ftp programs measure speed in bytes per second.
DSL speeds are measured in bits per second. There are 8 bits in a byte.
If you can download at 64 kilobytes per second then that is the same as
512 kilobits per second.
230 Anonymous access granted, restrictions apply.
ftp> hash
Hash mark printing On ftp: (2048 bytes/hash mark) .
ftp> get test.1meg
200 PORT command successful
150 Opening ASCII mode data connection for test.1meg (1048576 bytes)
#
#
#
ftp: 1048576 bytes received in 5.96Seconds 175.94Kbytes/sec.
ftp>
ftp> cd upload
250 CWD command successful
ftp> put test.1meg
200 PORT command successful
150 Opening ASCII mode data connection for test.1meg
#
#
#
226 Transfer complete.
ftp: 1048576 bytes sent in 5.98Seconds 175.23Kbytes/sec.
ftp>
ftp>

I think that you might be able to redirect the output of your command to a file. e.g, at the end of the command add (assuming that you have a directory c:\temp)
your command here > c:\temp\TestOutput.text
Then in your program, add a file system watcher to watch that file and load it into the textbox when it changes. If you're doing this lots of time then you might have to dynamically generate a filename and delete the files when no-longer needed.

Related

Jmeter non GUI mode csv report not showing latency

I am trying to get the jmeter html report for file transfer in SFTP protocol.
I am using SSH SFTP Protocol plugin and added Simple Data Writer to that thread group.
I have created my own sftp server using Apache MINA. Jmeter script will hit the server which i created and uploads the file.
Script Parameters:
Thread Group - 250
Ramp up period - 50
Loop Count - 1
After running the script in non GUI mode as nohup sh jmeter.sh -n -t Singlepart_MultipleThread_RampUp.jmx -l Singlepart_MultipleThread_RampUp.jtl. I do get a csv generated which i convert into html report command jmeter -g <csv> -o <destination_folder>.
The html report created shows Latency vs Time and Latency vs Request as zero and even the csv report shows latency column as zero.
Below is my user.properties file
user.properties
# Latencies Over Time graph definition
jmeter.reportgenerator.graph.latenciesOverTime.classname=org.apache.jmeter.report.processor.graph.impl.LatencyOverTimeGraphConsumer
jmeter.reportgenerator.graph.latenciesOverTime.title=Latencies Over Time
jmeter.reportgenerator.graph.latenciesOverTime.property.set_granularity=${jmeter.reportgenerator.overall_granularity}
# Latencies Vs Request graph definition
jmeter.reportgenerator.graph.latencyVsRequest.classname=org.apache.jmeter.report.processor.graph.impl.LatencyVSRequestGraphConsumer
jmeter.reportgenerator.graph.latencyVsRequest.title=Latencies Vs Request
jmeter.reportgenerator.graph.latencyVsRequest.exclude_controllers=true
jmeter.reportgenerator.graph.latencyVsRequest.property.set_granularity=${jmeter.reportgenerator.overall_granularity}
jmeter.properties
#---------------------------------------------------------------------------
# Results file configuration
#---------------------------------------------------------------------------
# This section helps determine how result data will be saved.
# The commented out values are the defaults.
# legitimate values: xml, csv, db. Only xml and csv are currently supported.
jmeter.save.saveservice.output_format=csv
# The below properties are true when field should be saved; false otherwise
#
# assertion_results_failure_message only affects CSV output
jmeter.save.saveservice.assertion_results_failure_message=true
#
# legitimate values: none, first, all
jmeter.save.saveservice.assertion_results=all
#
jmeter.save.saveservice.data_type=true
jmeter.save.saveservice.label=true
jmeter.save.saveservice.response_code=true
# response_data is not currently supported for CSV output
jmeter.save.saveservice.response_data=true
# Save ResponseData for failed samples
jmeter.save.saveservice.response_data.on_error=false
jmeter.save.saveservice.response_message=true
jmeter.save.saveservice.successful=true
jmeter.save.saveservice.thread_name=true
jmeter.save.saveservice.time=true
jmeter.save.saveservice.subresults=true
jmeter.save.saveservice.assertions=true
jmeter.save.saveservice.latency=true
# Only available with HttpClient4
#jmeter.save.saveservice.connect_time=true
jmeter.save.saveservice.samplerData=true
#jmeter.save.saveservice.responseHeaders=false
#jmeter.save.saveservice.requestHeaders=false
#jmeter.save.saveservice.encoding=false
jmeter.save.saveservice.bytes=true
# Only available with HttpClient4
jmeter.save.saveservice.sent_bytes=true
jmeter.save.saveservice.url=true
jmeter.save.saveservice.filename=false
jmeter.save.saveservice.hostname=false
jmeter.save.saveservice.thread_counts=true
jmeter.save.saveservice.sample_count=false
jmeter.save.saveservice.idle_time=true
# Timestamp format - this only affects CSV output files
# legitimate values: none, ms, or a format suitable for SimpleDateFormat
#jmeter.save.saveservice.timestamp_format=ms
#jmeter.save.saveservice.timestamp_format=yyyy/MM/dd HH:mm:ss.SSS
# For use with Comma-separated value (CSV) files or other formats
# where the fields' values are separated by specified delimiters.
# Default:
#jmeter.save.saveservice.default_delimiter=,
# For TAB, one can use:
#jmeter.save.saveservice.default_delimiter=\t
# Only applies to CSV format files:
# Print field names as first line in CSV
#jmeter.save.saveservice.print_field_names=true
# Optional list of JMeter variable names whose values are to be saved in the result data files.
# Use commas to separate the names. For example:
#sample_variables=SESSION_ID,REFERENCE
# N.B. The current implementation saves the values in XML as attributes,
# so the names must be valid XML names.
# By default JMeter sends the variable to all servers
# to ensure that the correct data is available at the client.
# Optional xml processing instruction for line 2 of the file:
# Example:
#jmeter.save.saveservice.xml_pi=<?xml-stylesheet type="text/xsl" href="../extras/jmeter-results-detail-report.xsl"?>
# Default value:
#jmeter.save.saveservice.xml_pi=
# Prefix used to identify filenames that are relative to the current base
#jmeter.save.saveservice.base_prefix=~/
# AutoFlush on each line written in XML or CSV output
# Setting this to true will result in less test results data loss in case of Crash
# but with impact on performances, particularly for intensive tests (low or no pauses)
# Since JMeter 2.10, this is false by default
#jmeter.save.saveservice.autoflush=false
So basically facing issue at two places:
How to get the latency value?
When i provide Ramp up value as 1, the script with Thread Group =50 takes around 16 seconds to complete the upload, whereas if i give Ramp up something other than 1 such as 10 then the script ends after 10 secs exact, irrespective of file is getting uploaded or not and providing vague results in html report as well.
Any idea how to solve this. Or need to do anything else in script.
You cannot as the plugin you're using doesn't call SampleResult.setLatency() function anywhere
theoretically it should be possible to request the functionality from the plugin developers
Setting 10 seconds ramp-up period for 50 virtual users means that JMeter starts with 1 virtual user and gradually increases the load to 50 within 10 seconds duration. Make sure to have enough loops defined in the Thread Group as you may run into the situation when 1st user has already finished uploading the file and was terminated and 2nd hasn't need started so you have maximum 1 user concurrency (it can be checked using Active Threads Over Time listener). See JMeter Test Results: Why the Actual Users Number is Lower than Expected for more detailed explanation if needed.

How to change the max size for file upload on AOLServer/CentOS 6?

We have a portal for our customers that allow them to start new projects directly on our platform. The problem is that we cannot upload documents bigger than 10MO.
Every time I try to upload a file bigger than 10Mo, I have a "The connection was reset" error. After some research it seems that I need to change the max size for uploads but I don't know where to do it.
I'm on CentOS 6.4/RedHat with AOL Server.
Language: TCL.
Anyone has an idea on how to do it?
EDIT
In the end I could solve the problem with the command ns_limits set default -maxupload 500000000.
In your config.tcl, add the following line to the nssock module section:
set max_file_upload_mb 25
# ...
ns_section ns/server/${server}/module/nssock
# ...
ns_param maxinput [expr {$max_file_upload_mb * 1024 * 1024}]
# ...
It is also advised to constrain the upload times, by setting:
set max_file_upload_min 5
# ...
ns_section ns/server/${server}/module/nssock
# ...
ns_param recvwait [expr {$max_file_upload_min * 60}]
If running on top of nsopenssl, you will have to set those configuration values (maxinput, recvwait) in a different section.
I see that you are running Project Open. As well as setting the maxinput value for AOLserver, as described by mrcalvin, you also need to set 2 parameters in the Site Map:
Attachments package: parameter "MaximumFileSize"
File Storage package: parameter "MaximumFileSize"
These should be set to values in bytes, but not larger than the maxinput value for AOLserver. See the Project Open documentation for more info.
In the case where you are running Project Open using a reverse proxy, check the documentation here for Pound and here for Nginx. Most likely you will need to set a larger file upload limit there too.

Why received ZFS dataset uses less space than original?

I have a dataset on the server1 that I want to back up to the second server2.
Server1 (original):
zfs list -o name,used,avail,refer,creation,usedds,usedsnap,origin,compression,compressratio,refcompressratio,mounted,atime,lused storage/iscsi/webhost-old produces:
NAME USED AVAIL REFER CREATION USEDDS USEDSNAP ORIGIN COMPRESS RATIO REFRATIO MOUNTED ATIME LUSED
storage/iscsi/webhost-old 67,8G 1,87T 67,8G Út kvě 31 6:54 2016 67,8G 16K - lz4 1.00x 1.00x - - 67,4G
Sending volume to the 2nd server:
zfs send storage/iscsi/webhost-old | pv | ssh -c arcfour,aes128-gcm#openssh.com root#10.0.0.2 zfs receive -Fduv pool/bkp-storage
received 69,6GB stream in 378 seconds (189MB/sec)
Server2 zfs list produces:
NAME USED AVAIL REFER CREATION USEDDS USEDSNAP ORIGIN COMPRESS RATIO REFRATIO MOUNTED ATIME LUSED
pool/bkp-storage/iscsi/webhost-old 36,1G 3,01T 36,1G Pá pro 29 10:25 2017 36,1G 0 - lz4 1.15x 1.15x - - 28,4G
Why is there such a difference in sizes? Thanks.
From what you posted, I noticed 3 things that seemed odd:
the compressratio is 1.15x on system 2, but 1.00x on system 1
on system 2, used is 1.27x higher than logicalused
the logicalused and the number zfs receive report are ~2.3x higher on system 1 than system 2
These terms are all defined in the man page, but are still confusing to reverse-engineer explanations for in practice.
(1) could happen if you enabled compression on the source dataset after you wrote all the data to it, since ZFS doesn't rewrite the data to compress it when you enable that setting. The data sent by zfs send is uncompressed unless you use -c, but system 2 will try to compress it as it runs zfs receive if the setting is enabled on the destination dataset. If both system 1 and system 2 had the same compression settings before the data was written, they would have the same compressratio as well.
(2) can happen due to metadata written along with your data, but in this case it's too high for "normal" metadata, which accounts for 1-2% of most pools. It's probably caused by a pool-wide setting, like configuring RAID-Z, or a weird combination of striping and mirroring (like 4 stripes, but with one of them being a mirror).
For (3), I re-read the man page to try to figure it out:
logicalused
The amount of space that is "logically" consumed by this dataset and
all its descendents. See the used property. The logical space
ignores the effect of the compression and copies properties, giving a
quantity closer to the amount of data that applications see.
If you were sending a dataset (instead of a single iSCSI volume) and the send size matched system 2's logicalused value (instead of system 1's), I would guess you forgot to send some child datasets (i.e. by using zfs send -R). However, neither of those are true in this case.
I had to do some additional digging -- this blog post from 2005 might contain the explanation. If system 1 didn't have compression enabled when the data was written (like I guessed above for (1)), the function responsible for not writing zeroed-out blocks (zio_compress_data) would not be run, so you probably have a bunch of empty blocks written to disk, and accounted for in the logicalused size. However, since lz4 is configured on system 2, it would run there, and those blocks would not be counted.

I need to count how many .zip files in a folder and transfer to a variable. Then compare with successful 226 transfers in a txt log file

I found this site using a search which was a great help. I was able to modify part of a previous solution to do what I need but I still need some help. I need to do this in a batch file and was hoping to get a solution or two.
What I need to do is Transfer 1 to 10 zip files from my PC to multiple FTP Servers. I then need to check to make sure they are transferred successfully. On my PC I'm using regular MS FTP and the servers are using IndiFTPD. I have everything done except for the checking part. Some of the FTP Servers are Dial up and wireless and they get disconnected from time to time. So if I'm transferring say 3 files and the first one fails but the other two are successful my script lists it as successful.
I have was able to get a count of how many zip files are in the transfer folder and put it into a variable. The code for that is:
#echo off
for /f %%A in ('dir *.zip ^| find "File(s)"') do set cnt=%%A
echo Zip File count = %cnt%
What I'm having trouble with is getting the same information from the text log file of the FTP transfer and then comparing the two to make sure they are the same. Here is an example of a log of an FTP transfer I would make:
ftp> Connected to Host1.
open Host1 21
220 Connected to IndiFTPD
ftp> Username user
user1
331 Password required for Folder1.
230 User user1 logged in.
ftp> Hash mark printing On ftp: (2048 bytes/hash mark) .
ftp> hash
binary
200 Type is set to I.
ftp> mput *.zip
200 PORT command successful.
150 Opening BINARY mode data connection for 2012_07_01_03_40_1_3_TESTFTPs.zip.
###############################################################################################
226 [Bytes: 195046][Time: 1.13 s][Speed: 168.26 K/s]
ftp: 195046 bytes sent in Seconds Kbytes/sec.
0.78251.67200 PORT command successful.
150 Opening BINARY mode data connection for 2012_07_01_03_40_2_3_TESTFTPs.zip.
###############################################################################################
226 [Bytes: 195046][Time: 1.13 s][Speed: 168.41 K/s]
ftp: 195046 bytes sent in Seconds Kbytes/sec.
0.77253.31200 PORT command successful.
150 Opening BINARY mode data connection for 2012_07_01_03_40_3_3_TESTFTPs.zip.
###############################################################################################
226 [Bytes: 195046][Time: 1.14 s][Speed: 166.79 K/s]
ftp: 195046 bytes sent in Seconds Kbytes/sec.
ftp> 0.78249.42bye
221 Exit.
I would like to be able to use the %cnt% variable from the first part of the script to get the count of zip files I have. Then I would like to get able to count the number of "226 [Bytes" in the log file which is named terminal-ftp.txt. Then once I have both values in variable form I need to compare them to ensure I have 3 FTP files and 3 Successful 226 transfers. If they don't match then I would need to flag it up for a retry.
Get the 226 results:
for /f "usebackq tokens=3 delims=: " %%A in (`find /c "226 [Bytes" "terminal-ftp.txt"`) do set "xTTS=%%A"
echo Successful 226 Transfers = %xTTS%
Compare the results:
if "%xTTS%" EQU "%cnt%" echo The counts match
if "%xTTS%" NEQ "%cnt%" echo The counts do not match
For great Batch references:
command /?, Technet, Rob van de Woude, DosTips, and SS64

Upload Files to Mainframes from VB.net

I am trying to upload a file from my pc to mainframes. I am trying to upload it using Chilkat FTP2. Below is the code.
The file I am trying to upload is 2009102600000
Dim ftp As New Chilkat.Ftp2()
Dim success As Boolean
' Any string unlocks the component for the 1st 30-days.'
success = ftp.UnlockComponent("Anything for 30-day trial")
If (success <> true) Then
MsgBox(ftp.LastErrorText)
Exit Sub
End If
ftp.Hostname = "www.myside.com"
ftp.Username = "****"
ftp.Password = "****"
' The default data transfer mode is "Active" as opposed to "Passive".'
' Change it to Passive by setting the Passive property:'
ftp.Passive = true
' Connect and login to the FTP server.'
success = ftp.Connect()
If (success <> true) Then
MsgBox(ftp.LastErrorText)
Exit Sub
End If
' Change to the remote directory where the file will be uploaded.'
success = ftp.ChangeRemoteDir("ABC.SITEUPLOAD.UPLOAD")
If (success <> true) Then
MsgBox(ftp.LastErrorText)
Exit Sub
End If
' Upload a file.'
Dim localFilename As String
localFilename = "c:\2009102600000"
Dim remoteFilename As String
remoteFilename = "2009102600000"
success = ftp.PutFile(localFilename,remoteFilename)
If (success <> true) Then
MsgBox(ftp.LastErrorText)
Exit Sub
End If
ftp.Disconnect()
MsgBox("File Uploaded!")
The error I am getting is dataset not found use MVS dsn name or something like that.
I would really appreciate if you can help me out with this one please.
I'm not at all sure you can treat data set prefixes as directories. When I'm doing uploads to the mainframe with ftp, I always just specify the full target name. I would get rid of the
ftp.ChangeRemoteDir("ABC.SITEUPLOAD.UPLOAD")
section altogether and just change:
remoteFilename = "2009102600000"
to:
remoteFilename = "'ABC.SITEUPLOAD.UPLOAD.2009102600000'"
if it's a sequesntial data set, or:
remoteFilename = "'ABC.SITEUPLOAD.UPLOAD(2009102600000)'"
if it's a member (in which case the data set will have to exist first).
It would also help if you changed the MsgBox statements so that they included an indication as to what is actually causing the error. Something along the lines of:
MsgBox("Connect error: " & ftp.LastErrorText)
MsgBox("ChangeRemoteDir error: " & ftp.LastErrorText)
MsgBox("PutFile error: " & ftp.LastErrorText)
instead of the generic:
MsgBox(ftp.LastErrorText)
One other point: you'll notice I've put single quotes around the targets above. That's because z/OS has a habit of (sometimes) prefixing your login name to members. It may be that:
put xyz.txt upload(xyz)
is actually trying to put it into yourname.upload(xyz). Quoting it will prevent that.
Update: You know, I just noticed something that totally escaped me the first time I read this question. The error message spells it out plainly.
Data set name segments and member names within partitioned data sets are limited to 8 characters. Hence your 'ABC.SITEUPLOAD.UPLOAD(2009102600000)' is invalid on two counts, the SITEUPLOAD and the 2009102600000. Try shortening the names and re-transferring.
Here's the proof:
C:\Documents and Settings\Pax> ftp bigiron
Connected to bigiron.box.com.
220-FTPD1 IBM FTP CS V1R9 at BIGIRON.BOX.COM, 02:15:23 on 2009-11-06.
220 Connection will close if idle for more than 5 minutes.
User (bigiron.box.com:(none)): pax
331 Send password please.
Password:
230 PAX is logged on. Working directory is "PAX.".
ftp> put test.txt 'pax.siteupload'
200 Port request OK.
501 Invalid data set name "'pax.siteupload'". Use MVS Dsname conventions.
ftp> put test.txt 'pax.siteupld'
200 Port request OK.
125 Storing data set PAX.SITEUPLD
250 Transfer completed successfully.
ftp: 177 bytes sent in 0.00Seconds 177000.00Kbytes/sec.
ftp> put test.txt 'pax.jcl(abcdefghi)'
200 Port request OK.
501 Invalid data set name "'pax.jcl(abcdefghi)'". Use MVS Dsname conventions.
ftp> put test.txt 'pax.jcl(abcdefgh)'
200 Port request OK.
125 Storing data set PAX.JCL(ABCDEFGH)
250 Transfer completed successfully.
ftp: 177 bytes sent in 0.00Seconds 177000.00Kbytes/sec.
ftp> bye
221 Quit command received. Goodbye.
Are you sure you don't need to store it as a generational dataset from the root directory? Like this:
'ABC.SITEUPLOAD.UPLOAD.2009102600000(+1)'