Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Java Network performance analyser program help

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Location
    UK
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java Network performance analyser program help

    Hi I'm quite comfortable programming java basics but have never looked at the networks side of it before.

    I have been asked to create a simple program which sends a file to a computer accross the network and measure how long it takes to send and recieve.

    I'm confused where to begin on this one.

    Any hints or tips would be fantastic


  2. #2
    Member
    Join Date
    Mar 2011
    Location
    Earth!
    Posts
    77
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Java Network performance analyser program help

    Look into the two classes ServerSocket and Socket. ServerSocket allows you to create a server that listens for a port, Socket allows you to connect to it. Also, read about DataInputStream and DataOutputStream. They make this kind of things a lot easier.

    When you send over the file, just regard it as bytes. Read a number of bytes from the file, send them to the client or server (depending on who recieves the file), read more bytes, send them, and so on. This is also why I mentioned DataInputStream. It has a method called "readFully". Use it when you read the bytes from the file and when you read them from the network. It handles a few things automatically that can be tricky otherwise.

    EDIT:

    A simple tutorial on servers and clients and so.
    http://download.oracle.com/javase/tu...ets/index.html

    Documentation of the classes I mentioned.
    http://download.oracle.com/javase/6/...verSocket.html
    http://download.oracle.com/javase/6/...et/Socket.html
    http://download.oracle.com/javase/6/...putStream.html
    http://download.oracle.com/javase/6/...putStream.html
    Last edited by Kerr; March 15th, 2011 at 05:04 PM.

  3. #3
    Junior Member
    Join Date
    Mar 2011
    Location
    UK
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Network performance analyser program help

    That is great thank you very much, going to look into it now and give it a go, will let you know how it goes.

  4. #4
    Member
    Join Date
    Mar 2011
    Location
    Earth!
    Posts
    77
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Java Network performance analyser program help

    No problems. Good luck .

  5. #5
    Junior Member
    Join Date
    Mar 2011
    Location
    UK
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Network performance analyser program help

    Does anyone know of any programs which exist similar to this?

Similar Threads

  1. How to enumarete Network Nodes using Java
    By dilshadpaleri in forum Java Networking
    Replies: 0
    Last Post: September 7th, 2010, 06:45 AM
  2. Increasing performance of my graphics routines
    By willberg in forum AWT / Java Swing
    Replies: 6
    Last Post: November 16th, 2009, 01:41 PM
  3. Performance of Type Casting and Conversions
    By fritzoid in forum Java Theory & Questions
    Replies: 1
    Last Post: October 1st, 2009, 07:56 PM
  4. Cracking password in less number of Trials using brute forcea
    By xisstar in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 10th, 2009, 10:40 AM
  5. Replies: 1
    Last Post: May 13th, 2008, 08:08 AM