How do I measure transfer speed on an IO Connection?

I bet there are hundreds of ways :)
But I was looking for something that is like built into Java.
Lets say you got a "normal" socket read like this:
            BufferedInputStream buffIn = new BufferedInputStream(sock.getInputStream());
            DataInputStream dataIn = new DataInputStream(buffIn);
            while(running) {
                int c;
                while( (c=dataIn.read()) != 0xff) {
               // Do what ever.
             }How would U meansure speed?

BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
int r;
while( (r=in.read()) != -1) {
    speed();
private void speed() {
    if(System.currentTimeMillis()-time > 1000) {
     String rate = "Transfer rate " + printTime(bytes) + " /sek";
     System.out.println(rate);
     bytes=0;
     time = System.currentTimeMillis();
    } else bytes++;
public String printTime(float time) {
    String toReturn = "" + time;
    if(((int)time)/((int)1024)>((int)0)) {
     time = time/1024;
    } else return "" + time + " byte";
    if(((int)time)/((int)1024)>((int)0)) {
     time = time/1024;
    } else return "" + time + " kilobyte";
    if(((int)time)/((int)1024)>((int)0)) {
     time = time/1024;
    } else return "" + time + " megabyte";
    if(((int)time)/((int)1024)>((int)0)) {
     time = time/1024;
    } else return "" + time + " gigabyte";
    return toReturn;
}

Similar Messages

  • How can i measure the speed of the fan in sound and vibration signal simulator box

    how can i measure the speed of the fan in sound and vibration signal simulator box
    provided the values  tach out:2 pulses/revolution and  maximum speed = 6000rpm

    Hi. I tried your suggestion and I could not get it to work well. In
    fact it worked better without the running average (which suprised me).
    I also played with the number of data points but still could not get it
    to work well.
    Do you have any other suggestions on how I could sort this problem out?
    I
    have attached a screen shot of the signal. To recap, I'm trying to
    measure the'y' position of the flat regions of the signal. The signal
    does not have a constant level, so this 'y' position varies with time
    in a non-unform manner.
    I am currently differentiating
    the signal and selecting the y position when the differential is equal
    to zero (within a tolerance band).
    In the screenshot, the
    signal has been zeroed using the method I have described above.
    However, it occasionally has glitches which may be caused when the code
    picks up a zero gradient at a peak or valley in the signal.
    I therefore need some kind of algorithm that only measures the position of the flat regions.
    Many thanks
     John
    Attachments:
    screenshot.gif ‏121 KB

  • Regarding Transfer speed in Cisco Any Connect

    Hi,
    I was trying to check transfer speed from Cisco Any Connect, with only ports opened in firewall 443 & 80 with 1 destination , but to complete data transfer of 50MB file it takes around 40mins, but if all ports are unblocked in Firewall with 1 destination ,it takes only 9mins.
    so wanted to know the correct port numbers which needs to be opened to make data transfer speed fast & why this behaviour.
    Please somebody help me.

    a customer has confronted me with a similar issue. They are using AnyConnect SSL Clients in their LAN, and noticed a severe performance drop on client side once connected via AnyConnect.  I have set this up in a lab environment to compare LAN performance with AnyConnect SSL performance.
    Win7 Client                                                                                                                
    AnyConnect                                              ASA5520                                                    Win7 iperf Server
    Secure Mobility -----------1Gb LAN---------------- v9.1.1---------------------1Gb LAN--------------------  TCP Window Size 4MB
    3.1.02040
    The ASA was configured from factory default and there was no traffic passing besides this test. AnyConnect used DTLS, and interface mtu on the ASA was 1500, the AnyConnect mtu was left unmodified, so I suspect the maximum of 1406 bytes was used.
    Result:
    - While AnyConnect was disconnected, Iperf reported bandwidth usage of about 300Mbps. This was what I was expecting.
    - As soon as I was connected via AnyConnect, the bandwidth usage dropped tp about 80Mbps. I expected a slight drop, but not this much.
    What causes such decrease in performance? Sure, if connected via the Internet, clients will most likely never notice this, but the customer uses AnyConnect SSL in a Gigabit LAN environment. Could the bottleneck be on the client side? The load and memory usage on the ASA side was very low. I have tried several ASA versions, but they all deliver similar results.

  • How to measure transfer (speed) of internet connection with TC

    Hi
    How can I find out how quick I surf the net with Time Capsule. Are there any opportunities in the setting to boost speed?
    Thanks,
    MF

    Speed can be measured through the normal web apps that test your internet speed.
    Frankly, unless you have 100mbit fibre the rate determining step is going to be the internet. For now and a long time to come. So measuring speed on your local network is irrelevant to web speed.
    The utility Activity Monitor shows network speed, and I am sure you can download other meters that will average speed over longer periods. But I find the activity monitor is adequate for what I need.
    Boost speed.. sure.. use ethernet.. do not use wireless. Make sure you are linked at gigabit.
    For wireless if you are close to the TC force the wireless to 5ghz. This usually requires that you setup TC wireless with a different name for 5ghz band than 2.4ghz. In the same room 5ghz should be twice the speed of 2.4ghz or better.. but the advantage will drop off quickly.. so you need to locate equipment nearest where you use it.

  • How can I increase the speed of my wifi connection on my iPhone 4?

    Hey everybody. Okay, so long story short, my wifi speed on my iPhone 4 (Verizon) is pretty slow. So slow that I almost never turn it on because of the sluggish download speeds. However, I definitely want to have it on.
    I use the speedtest app, an my wifi at home (router in the next room) is clicking at:
    141ms ping
    0.72Mbps Down
    0.41Mbps Up.
    I'm seeing people on these forums post results like 9Mbps down, 5 up, etc. and I'm envious. How can I improve mine?
    Thanks in advance.

    There's nothing that can be done on the iPhone to affect the speeds via Wi-Fi, the iPhone simply is not the issue.
    What speed is the Internet service provided by your ISP?
    Is the wireless router you are connected to an 802.11b? g? or n? router?
    Both of these factors dramatically affect performance.
    Go to any Wi-Fi hotspot, you'll see a difference in speed.

  • How can I improve the speed of my QuickVPN connection?

    I have finally got my "Quick"VPN connection working with my small business network. In the past, I used a PPTP VPN via Windows to connect to the network, but was limited to one person on at a time. Now I have a QuickVPN we can have up to 10 people connected, but the speed is considerably slower. I haven't done any hard core testing. Before I spend even more time on this, I wanted to see if there were any good ideas out there.
    Do you have any?
    Thanks!

    I have finally got my "Quick"VPN connection working with my small business network. In the past, I used a PPTP VPN via Windows to connect to the network, but was limited to one person on at a time. Now I have a QuickVPN we can have up to 10 people connected, but the speed is considerably slower. I haven't done any hard core testing. Before I spend even more time on this, I wanted to see if there were any good ideas out there.
    Do you have any?
    Thanks!

  • Transfer speed of USB vs Gigaport attached drive WRT610N

    I know this is a loaded question but here goes:  Assumptions:  eqivalent drive specs but one is connected to the USB port of a 610N and the other is connected to the gigaport of the 610N which drive should have the fastest throughput and approximately by what % margin?
    The reason that I am asking this question is that I did a backup of about 40GB to a Seagate drive attached to the USB port and it TOOK FOR EVER!!!!!!!!!!!!!!
    I have a gig capable drive on order and am praying that the performance will be much better than the USB drive.

    What is the speed you are getting from the USB Port..?
    I think you need to make some changes on your Wireless router, so the Download and upload speed improves.
    Open an Internet Explorer browser page on your wired computer(desktop).In the address bar type - 192.168.1.1 Leave username blank & in password use admin in lower case...
    For Wireless Settings, please do the following : -
    Click on the Wireless tab -
    This settings are for 2.4GHz.
    -Here select manual configuration...Wireless Network mode should be mixed...
    -Provide a unique name in the Wireless Network Name (SSID) box in order to differentiate your network from your neighbours network...
    - Set the Radio Band to Standard-20MHz and change the Standard channel to 11-2.462GHz...Wireless SSID broadcast should be Enabled and then click on Save Settings...
    Please make a note of Wireless Network Name (SSID) as this is the Network Identifier...
    For Wireless Security : -
    Click on the Sub tab under Wireless > Wireless Security...
    Change the Wireless security mode to WEP, Encryption should be 64 bits.Leave the passphrase blank, don't type in anything...
    Under WEP Key 1 type in any 10 numbers please(numbers only and no letters eg: your 10 digit phone number) and click on save settings...
    Please make a note of WEP Key 1 as this is the Security Key for the Wireless Network...
    Click on Advanced Wireless Settings
    Change the Beacon Interval to 75 >>Change the Fragmentation Threshold to 2304, Change the RTS Threshold to 2304 >>Click on "Save Settings"...
    Now see if you can locate your Wireless Network and attempt to connect, and after this try Downloading and Uploading on your Storage Drive and check whats the speed you are getting
    Same goes for your 5GHz Wireless Network.
    Wireless Network mode should be mixed...
    -Provide a unique name in the Wireless Network Name (SSID) box in order to differentiate your network from your neighbours network.
    Set the Radio Band to Wide-40MHz and change the Wide channel to159 and Standard Channel to 161-5.805GHz...
    For Wireless Security : -
    Click on the Sub tab under Wireless > Wireless Security...
    Change the Wireless security mode to WPA, For Encryption, select AES...For Passphrase input your desired WPA Key. For example , MySecretKey , This will serve as your network key whenever you connect to your wireless network. Do NOT give this key to anyone and remember the key.
    NOTE : Passphrase should be more that 8 characters...
    Try and see how is the data transfer speed.

  • USB transfer speed checker

    In windows 7 it's quite easy to see the transfer speed of say a USB drive, but I've been trying to search up some sort of app or widget that can tell you how fast the USB transfer speed is, just to gauge the performance. I know there is xbench but that's just read/write speeds. Thanks.
    Message was edited by: Nanotechnology

    In windows 7 it's quite easy to see the transfer speed of say a USB drive, but I've been trying to search up some sort of app or widget that can tell you how fast the USB transfer speed is, just to gauge the performance. I know there is xbench but that's just read/write speeds. Thanks.
    Message was edited by: Nanotechnology

  • How do I measure throughput rate of wireless conne...

    I have recently replaced by HH3 by HH5, I seem to be lucky in not having met any of the problems reported by others. But I would like suggestions about measuring the speed of the wireless connection to my laptop. I am on 40/10 infinity. I have installed the BT wireless AC dongle.
    If I use 5GHz wireless I am getting rates of 350 to 450 on the connection. But if I use the BT speedtester to check the throughput I get amazingly low download figures (about 8meg). However if I use Speedtest.net I get very good figures (over 38 download and over 10 upload). So which test (if either) gives a meaningful measure of throughput? Or is there some better way of measuring?
    Interestingly if I use 2.4G wireless, I get good figures on both testers.
    Thanks for any suggestions.

    applejuice92 wrote:
    Also seems quite silly to spend 1-200 dollars thats solely for health purposes than to wait a couple extra months for a product that will have that capability and much more integration for so many other things that you probably do an a daily basis (such as phone, messages, calendar, reminders, etc..) But hey, I'm not rich, and you probably are so...
    Where did I recommend spending hundreds of dollars on anything? The Withings app is free. I think I paid less then $4 for Cardiio. They both use the iPhone's camera (already included) to take a pulse reading. And, taking one's pulse with a stopwatch (built into the phone) and fingers (built into most people) and entering it manually is free.
    Yes, you could get a BT heart rate chest strap if you wanted. They run about $50-60, not $100-200. But, no, that's not necessary.

  • How to measure angular speed by RVDT

    Hello,
    I quite new in labVIEW and I am trying to measure angular speed of shaft by RVDT which is able to measure in electrical range 0°-280°. I use NI USB-6008 card and RVDT is also powered by this card (5V). I have already found way how to measure angular position but i do not now how to convert it to angular speed. I tryed to do it by derivation but the result was weird. Could anybody give me an advice how to do that. I would really appreciate that.
    My VI is attached.
    Attachments:
    rot pot.vi ‏154 KB

    Hi kome01,
    The issue comes from the fact you are only acquiring one sample per iteration of the loop, and to differentiate you need to provide at least two values, as well as a time difference between each.
    The Express VI you are using is clever in the way that it can measure the time between samples for you, but you will still need to provide multiple samples. I have changed your VI to continuously acquire samples from the potentiometer, and have provided some notes in the block diagram to help you.
    Hope this helps!
    Attachments:
    rot pot.vi ‏153 KB

  • How can I measure the copy speed of my compact flashcard to folder?

    how can I measure the copy speed of my compact flashcard to folder?
    I dont have a stop watch.

    Hi Steve Zavodny;
    Generally compact flash cards or basically slow because of them being flash memory and USB. What are you after here?
    Allan

  • How do I fix the slow transfer speed over USB on my 24" iMac?

    I am backing up/cloning with SuperDuper, and running Lion.  The displayed transfer speed never gets past about 20mb per second.  Painfully slow....  Any suggestions?

    Actually that's pretty good for USB. USB is slow - there is nothing you can do about it. Firewire always has been faster. Personally, I only use external Firewire drives for cloning or backing up. Even then, if it's a fresh clone, it'll take moe than an hour for 160 GB.
    So, I schedule it when I have other things to do and walk away until it's done.

  • How do I see file transfer speeds?

    Hey guys, does anyone know if it's possible for me to see file transfer speeds instead of just the time remaining in Finder?

    Hi,
    In song view, go to menu > view > view options and select bit rate, file type and size.
    In preferences, you can change import settings to Apple lossless. When you use file > create new version you can now can now convert from aiff to lossless.
    Create playlist based of file type being lossless.
    Jim

  • New Media Hub NMH405 - Transfer speeds

    I have a brand new Media Hub with 2 Seagate 1.5 TB drives in RAID 0 (Linear 2), and the transfer and read speed are horrendous.  The Media Hub has the latest software (2.17.13), and the drives are not the batch of drives that are affected by freezing/throughput issues.  Maximum SMB transfers are aound 3 MB/s bidirectionally.  Playback seems to be okay for the most part as long as I dont start more than one stream.  The main networking device is a brand new Apple Airport Extreme which has 3 GBE and a dual band draft N accesspoint.  Everything else seems to be in order, but the speeds are horribly slow.
    I was going to put the device in single drive mode to see if the problem was the RAID, but I wanted to check first to see if anyone else had any ideas.
    Message Edited by jedson328 on 01-24-2009 11:04 AM

    I would like to get some info on your system that you are testing with - OS version, connection type (are you hardwired or wireless to your router), computer specs..etc.
    How are you measuring the performance? Are you using a tool? We would love to make sure the Media hub is running at the best possible performance, and from all our testing internally and externally it is, so your issues are certainly a concern.

  • Slow USB transfer speed when iTunes is running

    hello everyone,
    today I was trying to transfer a bunch bunch of files from my NAS to a portable USB 3 hard drive.
    the transfer speed was 18 to 20 mbytes/s... quite slow for this device.
    after investigation the problem was found that when iTunes (11.0.1) is NOT running the tranfer speed goes up to 90+ mbytes/s
    anyone has an idea on how to solve the problem?

    The only testing that could be performed prior to resetting the AirPort would be to make throughput performance measurements ... but, at best, these would only stand to confirm the slow transfer speeds that you are seeing.
    However, if you do want to make some quantitative measurements, one easy to use (& free) utility is: AJA System Test.

Maybe you are looking for

  • Buffer busy waits yet another issue.

    Hi, Here is the scenario we are facing. The application is trying to insert the data into one of the partition and the table on which this buffer busy waits is occuring is on an tablespace with ASSM and extent management auto. total number of inserts

  • Sort by last name

    Is there a way to sort artists by their last name?

  • Switching on/off WiFi by main menu icon

    I had configured my Snow Leopart to ask for password confirmation when switching on/off the Airport. Whenever triggered the password popup came up and the user was able to immediately enter the password, because the dialog automatically received keyb

  • HP Pavilion - Do I need external Recovery option?

    Hi, I have just bought a HP Pavilion 15.  Keep getting contractdictory advice.  Some say must have an external Recovery option; others say why, there is no need and it is a lot of hassle to create a set.  Need advice: 1)  is it really necessary to ha

  • Dynamic Text Area

    Hi EveryOne, Due to font rendering issues in flex 3, I've decided to create a custom dynamic TextArea because my App consists of different languages. So in creationComplete Handler, Im calling a method like this var str:String = htmlTextModification(