I have a homework, in which we should implement a server/client classes, so that we send 1400Bytes packets to the server and we get them back as reply. We must mess the throughput in kbit/s and it must be printed when there a timeout by the server! but the problem is that I'm calculating the throughput in the Client-Class, and trying to print it in the 'catch block' of the timeout-exception in the Server-Class, but this value is always transmitted/printed as 0.0, which is not the case when I print it in the Client-Class! I tried with simple static variable, with static get-method, but it doesnt work! 
Can anyone help me please? I must give it back today at 00:00! It Would be great! Thanks!

```
package blatt6;

import java.io.*;
import java.net.*;

public class UDPClient
{
static double startTime;
static double endTime;
static double dauer; 
static double paketGroesseKBit = (1400*8) / 1024;
private static double durchsatz;

public static void main(String args[])
{
    DatagramSocket sock = null;
    int port = 7777;
    String s = "";

    for (int i=0; i<1400; i++) {
        s = s + 'b';
    }

    //BufferedReader cin = new BufferedReader(new InputStreamReader(System.in));

    try
    {
        sock = new DatagramSocket();
        InetAddress host = InetAddress.getByName("localhost");

        int j=0;
        while(j<4)
        {
            //take input and send the packet
            echo("Enter message to send : ");
            //s = (String)cin.readLine();

            byte[] b = s.getBytes();    
            DatagramPacket  dp = new DatagramPacket(b , b.length , host , port);    
            byte[] buffer = new byte[1400];
            DatagramPacket reply = new DatagramPacket(buffer, buffer.length);

            sock.send(dp);
            startTime = System.nanoTime();      
            //buffer to receive incoming data
            sock.receive(reply);
            endTime = System.nanoTime();
            dauer = endTime - startTime;
            durchsatz = paketGroesseKBit / ((dauer/2) * Math.pow(10, -9));
            //System.out.println(dauer);

            j++;        
//              byte[] data = reply.getData();
//              s = new String(data, 0, reply.getLength());
//              
//              //echo the details of incoming data - client ip : client port - client message
//              echo(reply.getAddress().getHostAddress() + " : " + reply.getPort() + " - " + s);
        }
    }

    catch(IOException e)
    {
        System.err.println("IOException " + e);
    }
}

//simple function to echo data to terminal
public static void echo(String msg)
{
    System.out.println(msg);
}

public static double getDurchsatz() {
    return durchsatz;
}
}

```

Here Server:

```
package blatt6;

import java.io.*;
import java.net.*;

public class UDPServer
{

static double durchy = UDPClient.getDurchsatz();

public static void main(String args[])
{
    DatagramSocket sock = null;
    int timeout = 5000;

    try
    {
        //1. creating a server socket, parameter is local port number
        sock = new DatagramSocket(7777);
        sock.setSoTimeout(timeout);
        //buffer to receive incoming data
        byte[] buffer = new byte[1400];

        DatagramPacket incoming = new DatagramPacket(buffer, buffer.length);

        //2. Wait for an incoming data
        echo("Server socket created. Waiting for incoming data...");

        //communication loop
        while(true)
        {
            sock.receive(incoming);
            sock.send(incoming);                

//                byte[] data = incoming.getData();
//                String s = new String(data, 0, incoming.getLength());
//
//                //echo the details of incoming data - client ip : client port - client message
//                echo(incoming.getAddress().getHostAddress() + " : " + incoming.getPort() + " - " + s);       
//                s = "OK : " + s;
//
//                DatagramPacket dp = new DatagramPacket(s.getBytes() , s.getBytes().length , incoming.getAddress() , incoming.getPort());
//                sock.send(dp);
        }
    }

    catch(IOException e)
    {
        System.out.println(durchy);
        System.err.println("IOException " + e);
    }
}

//simple function to echo data to terminal
public static void echo(String msg)
{
    System.out.println(msg);
}
}

```