How to know current speed of connection in Kbps?

Does anyone know how to know the speed of network/internet connection? I couldn't find any member method of JAVA's class that returns this value. Very appreciate for all your hints.

Try something like this:public class Test
  public static void main(String[] argv)
    try
      URL url = new URL("http://java.sun.com"); /* put a pointer to some big image here */
      InputStream is = url.openConnection().getInputStream();
      int bytes = 0;
      long ms = System.currentTimeMillis();
      while(is.read() != -1) bytes++;
      ms = System.currentTimeMillis() - ms;
      double kbps = ((double)bytes / ((double)ms / 1000)) / 1024;
      System.out.println("kbps = " + (long)kbps);
      System.exit(0);
    catch(Throwable t)
      t.printStackTrace();
      System.exit(-1);
}I suggest you repeat this test for several pointers and take the average...

Similar Messages

  • How to know Information of a Connection Pool

    HI,
    I want to know the information of a connection pool for example its maxSize and
    what are the active connections in the pool programitically ie. thr' code.
    I can monitor them thr' console.But how to monitor a pool thr' code.
    And what does all the attributes like WaitSecondsHigh,Waiters,
    WaitersHigh mean.how can i get information about them.
    And how do i get the information of them thr' code.
    I have seen that JDBCConnectionPoolRuntime gives information about the pool.But
    how to create a object of this interface.
    Can anyone provide me the code for this.
    Let me explain more....
    I have created a demo pool and has set the maximum connections size as 2.I tried
    to get 3 connections from the pool and obvious a exception has raised.(java.sql.SQLException:
    Pool connect failed: weblogic.common.ResourceException: None available).
    so i am writing a class such that it keeps the connections in wait state when
    the pool has reached its maximum value for which i should know what are the active
    connections and the maximum size of the pool.
    So please if any one can help me how to know these values of the connetion pool
    programitically,it would be great.

    Ventak:
    This is a sample code i wrote some time ago.
    import weblogic.management.MBeanHome;
    import weblogic.management.WebLogicMBean;
    import javax.naming.Context;
    import javax.naming.NamingException;
    import javax.naming.AuthenticationException;
    import javax.naming.CommunicationException;
    import weblogic.jndi.Environment;
    import java.util.Collection;
    import java.util.Iterator;
    import weblogic.management.runtime.JDBCConnectionPoolRuntimeMBean;
    import weblogic.management.configuration.JDBCConnectionPoolMBean;
    import weblogic.management.WebLogicObjectName;
    public class mbean
    public static void main(String args[])
    MBeanHome home = null;
    try
    Environment env = new Environment();
    env.setProviderUrl(url);
    env.setSecurityPrincipal(username);
    env.setSecurityCredentials(password);
    Context ctx = env.getInitialContext();
    home = (MBeanHome) ctx.lookup(MBeanHome.JNDI_NAME+".wlcsServer");
    // Note the type of the Mbean: JDBCConnectionPoolConfig - The fixed
    configuration of the pool just as the console
    // JDBCConnectionPoolRuntime - The runtime parameters of the pool, like
    current connections
    // To retrieve the Mbean JDBCConnectionPoolMBean via ObjectName
    WebLogicObjectName o = new
    WebLogicObjectName("commercePool","JDBCConnectionPoolConfig","wlcsDomain","w
    lcsServer");
    JDBCConnectionPoolMBean pool = (JDBCConnectionPoolMBean)home.getMBean(o);
    // the same Mbean but without ObjectName
    JDBCConnectionPoolMBean pool =
    (JDBCConnectionPoolMBean)home.getMBean("ccPoolSuc","JDBCConnectionPoolConfig
    System.out.println("TableName " + pool.getTestTableName());
    // To retrieve the JDBCConnectionPoolRuntimeMBean
    JDBCConnectionPoolRuntimeMBean poolR =
    (JDBCConnectionPoolRuntimeMBean)home.getMBean(new
    WebLogicObjectName("wlcsDomain:ServerRuntime=wlcsServer,Name=sucPool,Locatio
    n=wlcsServer,Type=JDBCConnectionPoolRuntime"));
    System.out.println("getActiveConnectionsCurrentCount()" +
    poolR.getActiveConnectionsCurrentCount());
    // To retrieve a collection of the Mbeans by Type
    Collection Beans = home.getMBeansByType("JDBCConnectionPoolRuntime");
    catch(Exception ex)
    System.out.println("Error " + ex);
    ex.printStackTrace();
    return;
    These are extracts of the actual code, providing you diferent ways.
    By the way, the issue you are trying to solve with a waiting time for a
    connection to be available is an out-of-the-box functionality of the
    weblogic pool. But is also restricted to some like 5 secs. (if i remember
    well) and the reason is to avoid thread contention.
    So if you are going to implement some like that must be much carefull. The
    better way is to play with the InitialCapacity, MaxCapacity,
    CapacityIncrement and ShrinkPeriod parameters, giving the enough connections
    to avoid as possible as you can the situation in which exists waiters of
    connections.
    Hope this help.
    "Venkat Raghava Moganti" <[email protected]> wrote in message
    news:[email protected]...
    >
    HI,
    I want to know the information of a connection pool for example itsmaxSize and
    what are the active connections in the pool programitically ie. thr' code.
    I can monitor them thr' console.But how to monitor a pool thr' code.>
    And what does all the attributes like WaitSecondsHigh,Waiters,
    WaitersHigh mean.how can i get information about them.
    And how do i get the information of them thr' code.
    I have seen that JDBCConnectionPoolRuntime gives information about thepool.But
    how to create a object of this interface.
    Can anyone provide me the code for this.
    Let me explain more....
    I have created a demo pool and has set the maximum connections size as 2.Itried
    to get 3 connections from the pool and obvious a exception hasraised.(java.sql.SQLException:
    Pool connect failed: weblogic.common.ResourceException: None available).
    so i am writing a class such that it keeps the connections in wait statewhen
    the pool has reached its maximum value for which i should know what arethe active
    connections and the maximum size of the pool.
    So please if any one can help me how to know these values of the connetionpool
    programitically,it would be great.

  • How to know current bandwidth to be able to increase or decrease reserved streaming units ?

    Hi,
    how to know egress bandwidth by Azure Api to be able to increase reserved streaming unit if bandwidth reaches over 80%. Currently it is set to 1, but should be able to increase it when bandwidth is more than 160 mpbs(80% of available bandwidth which is 200mbps) 
    Thanks for your feedback in advance.

    Hi Sandhya,
    For now you can use Azure portal dashboard to check "Streaming Data Out". The chart will give you 30 minute aggregated values.
    Thanks,
    Cenk
    

  • How to know that remote object connection with server has not disconnected?

    Hi,
    In my application want to check weather connnection with
    remote object has disconnected or not. I have not found any
    property with remoteobject to verify this. Weather it is possible
    with remote object or if not then how it could be done with
    channel. I have checked connected property of channel but i could
    not find out how it works.
    Is there any solution for this, if any one know please
    reply...
    Thanks..

    Did you ever get resolved. I am having the sames issues
    Regards,
    Wally
    http://www.level10solutions.com

  • How to know if a socket connection is open ?

    Hi,
    I have a ftp class that opens a socket connection to a ftp server. Sometimes the connection is closed and I get an exception. There is any way to know if exists an open connection ?
    Thanks !

    From SDK v1.3.1 for abstract Class SocketImpl:
    Method connect
    protected abstract void connect(InetAddress address,
                                    int port)
                             throws IOException
        Connects this socket to the specified port number on the specified host.
    Parameters:
    address - the IP address of the remote host.port - the port number.Throws:
    IOException - if an I/O error occurs when attempting a connection.... So if it throws an exception on inception, it's NOT connected - NOT open, right? This is the class you've subclassed to create the socket connection? If not, which?

  • How to know current form name in oracle applications 11i.

    Hi all,
    By clicking on Help menu-> About Oracle Applications, it will display environment variables info, and current form info, on which we r working.
    I want to know from where this information is coming,
    Where oracle applicaitons will store this information.
    Is there any database table which regularly updates the current form info.
    Or is there any log which contains info about current form name.

    Hi
    For viewing this information you need to read system administration guide , Go through this pdf file
    http://download-uk.oracle.com/docs/cd/B11454_01/11.5.9/acrobat/115saug.pdf
    Nitin

  • How to know currently running ddl  by dba_views in oracle 9i

    sql_hash_value in v$session is showing 0 .presently create table is running which is done by copying from another table.
    Edited by: apusumit on May 16, 2012 1:46 AM
    Edited by: apusumit on May 17, 2012 12:08 AM

    apusumit wrote:
    sql_hash_value in v$session is showing 0 .presently create table is running
    Edited by: apusumit on May 16, 2012 1:46 AMSQL_HASH_VALUE 0 means sql has been completed. If you are sure that it is still running and showing SQL_HASH_VALUE 0, then show us what are you doing and how Oracle is responding you by simply copy and paste SQLplus screen text by below commands :
    set linesize 200
    set pagesize 1000
    select sql_text from v$sql where (ADDRESS,HASH_VALUE) in (select sql_address,sql_hash_value from v$session where sid= &sid_number);
    Anand @ find the current sql which is running against database
    OR
    select c.spid b1, b.osuser c1, b.username c2, b.sid b2, b.serial# b3,
    a.sql_text
    from v$sqltext a, v$session b, v$process c
    where a.address = b.sql_address
    -- and b.status = 'ACTIVE' /* YOU CAN CHOOSE THIS OPTION ONLY TO SEE
    -- ACTVE TRANSACTION ON THAT MOMENT */
    and b.paddr = c.addr
    and a.hash_value = b.sql_hash_value
    order by c.spid,a.hash_value,a.piece
    Adith @ What are current query running
    You can too check LAST_DDL_TIME of user_objects view.
    Regards
    Girish Sharma

  • How to know the Phone ID connected to a PC ?

    Hi, I want to know if it's possible to know from a PC desktop, in what Phone this PC is connected ?

    The exact same scenario has been discussed just a few posts down: http://forums.cisco.com/eforum/servlet/NetProf;jsessionid=rnvoktpv51.SJ1A?page=netprof&forum=IP%20Communications%20and%20Video&topic=IP%20Phone%20Services%20for%20Developers&CommCmd=MB%3Fcmd%3Ddisplay_location%26location%3D.1ddb1ea2

  • How to know current selection rectangle

    Hello,
    I need to know (with SDK) the current selection rectangle.
    I use listener to create my action fonction but listener let to Set a selection but not Get.
    If someone can help me...
    Thanks

    There is a bounds to a selection of a document. BEWARE: This is the bounding rectangle of the selection. If you have a selection with holes in it then you may not be getting what you expect.

  • Newbie question: how to know current namespace in dbx debugging environment

    Good afternoon,
    I have an application, running on a Solaris 5.8.
    This application gives errors because of namespace issues, therefore I would like to check the namespace I am working in while debugging with dbx, but I don't find the command for this.
    Does anybody know which command to launch within a dbx environment for displaying the current namespace?
    Thanks
    Dominique

    (dbx) help -k namespace
    scopes (command)
    (dbx) scopes
    Function PSeudoClass::plain_function()
    namespace PSeudoClass
    File "ambig.cc"
    Loadobject /export/home/test/c++/namespace/a.out

  • How to know current row is a new row ?

    Hi,
    i need to implement some logic in my BC4J JSP form commit process, but when it's a new row only.
    how can i do that ?
    Thanks,
    Ricky H.P.

    See:
    re:How to identify inserted/modified row(s) in a VO
    Regards

  • How do we know currently active call time in 6680?

    How do we know currently active call time? Whenever we receive or make a call, how can we know the call duration in Nokia 6680?

    Hello!
    Just take a look on page 27 of Manual.
    Recent calls: Connect -> Log -> Recent calls.
    Steps to activate call duration as follows: Connect -> Log -> Options -> Settings -> Show call duration. Select Yes.
    Andrey
    6150, 8310, 2100, 6310, 6310i, 6230, 6600, 6630, 6700, E60, N80, E61, N93
    N95, E61i, E71, E72,8600, 5800, N8

  • How can I know "No of open connections"

    Dear experts,
    How can I know "No of open connection". i.e. No of open connection.
    Thanks

    I'm assuming you probably just want the number of user sessions that are currently open, which would be
    SELECT COUNT(*)
      FROM v$session
    WHERE type = 'USER'Justin

  • How can I know which clients are connected to my network through express and which are connected through extreme?

    I have an airport express extending, through wireless, a network provided by an airport extreme. How can I know which clients are connected to my network through express and which are connected through extreme?
    Here you can see both routers:
    I would expect to some clients connected to the express, other than the extreme. And that's all I see: only the airport extreme appears as client of the airport express.
    Below, one can see the summary of the config for both routers.
    Would somebody explain it?
    Thanks,
    Marcelo
    Message was edited by: Marcelão

    please disregard this answer.
    Message was edited by: Marcelão

  • Does anyone Know how to fix error 0xe8000065 when connecting the ipod touch 4g

    does anyone Know how to fix error 0xe8000065 when connecting the ipod touch 4g

    See:
    iPhone, iPad, iPod touch: Unknown error containing '0xE' when connecting

Maybe you are looking for

  • With Time Machine I have an external hard drive formatted with Mac

    With Time Machine I have an external hard drive formatted with Mac. The record contained files windows. How to recover? Serious mistake: to connect a Mac to an external drive with data (important!) Windows, the warning appears: "You want to use the d

  • Editing text in all PDF files

    Hello, I am very new to Acrobat and am trying to change some text in some of my documents, but can't seem to be able to do so. I am using Acrobat X Pro and i use the "Edit Document Text" tool, but the cursor does not change to the text editing cursor

  • 5800 music problem

    so i have a nokia 5800 and i am very happy with it...well except for the music player. i was hoping that it would be fixed with the new firmware upgrade but sadly, it has not. so when i'm jamming my tunes at random moments a song will start playing a

  • Unwanted reloading Applet behavior

    I have a dynamic JTree component on an applet and as and when the user uses the application, nodes are added to or deleted from the JTree. But looks like the Applet behavior is to reload the applet everytime it is revisited or minimized/maximized, an

  • Is there a way to download files from the internet from my iPod?

    Such as pictures, music, or video? When I go to a downloading music site I can only listen to the music, not download it. Is there any way to do the right click save as action from the iPod?