Subversion Repositories programming

Rev

Rev 189 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 189 Rev 190
Line 33... Line 33...
33
     * Method: generatePacket
33
     * Method: generatePacket
34
     * Purpose: This method will generate a String that is size bytes in
34
     * Purpose: This method will generate a String that is size bytes in
35
     * length. This is assumed to be size bytes when transferred across
35
     * length. This is assumed to be size bytes when transferred across
36
     * the network.
36
     * the network.
37
     */
37
     */
38
    private static String generatePacket (int size)
38
    private static Byte[] generatePacket (int size)
39
    {
39
    {
40
        String packet = new String();
40
        Byte packet[] = new Byte[size];
41
        int i = 0;
41
        int i = 0;
42
 
42
 
43
        for (i=0; i<size; i++)
43
        for (i=0; i<size; i++)
44
            packet += "Z";
44
            packet[i] = 10;
45
 
45
 
46
        return packet;
46
        return packet;
47
    }
47
    }
48
 
48
 
49
    /**
49
    /**
Line 96... Line 96...
96
        {
96
        {
97
            System.err.printf ("Couldn't get I/O for the connection to: %s\n", hostName);
97
            System.err.printf ("Couldn't get I/O for the connection to: %s\n", hostName);
98
            System.exit(1);
98
            System.exit(1);
99
        }
99
        }
100
 
100
 
101
        String packet = generatePacket (packetSize);
101
        Byte packet[] = generatePacket (packetSize);
102
        String response;
102
        String response;
103
        int i = 0;
103
        int i = 0;
104
 
104
 
105
        /* Start the timer */
105
        /* Start the timer */
106
        startTime = new Date();
106
        startTime = new Date();
Line 113... Line 113...
113
        }
113
        }
114
 
114
 
115
        /* Stop the timer */
115
        /* Stop the timer */
116
        stopTime = new Date();
116
        stopTime = new Date();
117
 
117
 
-
 
118
        /* Send the exit sequence */
-
 
119
        out.println (exitSeq);
-
 
120
        
118
        /* Calculate and print all timing info */
121
        /* Calculate and print all timing info */
119
        printTimingInfo(startTime, stopTime);
122
        printTimingInfo(startTime, stopTime);
120
 
123
 
121
        /* Cleanup */
124
        /* Cleanup */
122
        out.close();
125
        out.close();