Deleted Added
full compact
spray.c (78780) spray.c (95658)
1/*
2 * Copyright (c) 1993 Winning Strategies, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef lint
32static const char rcsid[] =
1/*
2 * Copyright (c) 1993 Winning Strategies, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef lint
32static const char rcsid[] =
33 "$FreeBSD: head/usr.sbin/spray/spray.c 78780 2001-06-25 21:12:52Z dd $";
33 "$FreeBSD: head/usr.sbin/spray/spray.c 95658 2002-04-28 15:18:50Z des $";
34#endif /* not lint */
35
36#include <err.h>
37#include <stdio.h>
38#include <stdlib.h>
39#include <unistd.h>
40
41#include <rpc/rpc.h>

--- 86 unchanged lines hidden (view full) ---

128
129 /*
130 * For some strange reason, RPC 4.0 sets the default timeout,
131 * thus timeouts specified in clnt_call() are always ignored.
132 *
133 * The following (undocumented) hack resets the internal state
134 * of the client handle.
135 */
34#endif /* not lint */
35
36#include <err.h>
37#include <stdio.h>
38#include <stdlib.h>
39#include <unistd.h>
40
41#include <rpc/rpc.h>

--- 86 unchanged lines hidden (view full) ---

128
129 /*
130 * For some strange reason, RPC 4.0 sets the default timeout,
131 * thus timeouts specified in clnt_call() are always ignored.
132 *
133 * The following (undocumented) hack resets the internal state
134 * of the client handle.
135 */
136 clnt_control(cl, CLSET_TIMEOUT, (caddr_t)&NO_DEFAULT);
136 clnt_control(cl, CLSET_TIMEOUT, &NO_DEFAULT);
137
138
139 /* Clear server statistics */
137
138
139 /* Clear server statistics */
140 if (clnt_call(cl, SPRAYPROC_CLEAR, xdr_void, NULL, xdr_void, NULL, TIMEOUT) != RPC_SUCCESS)
140 if (clnt_call(cl, SPRAYPROC_CLEAR, (xdrproc_t)xdr_void, NULL,
141 (xdrproc_t)xdr_void, NULL, TIMEOUT) != RPC_SUCCESS)
141 errx(1, "%s", clnt_sperror(cl, NULL));
142
143
144 /* Spray server with packets */
145 printf ("sending %u packets of lnth %d to %s ...", count, length,
146 *argv);
147 fflush (stdout);
148
149 for (i = 0; i < count; i++) {
142 errx(1, "%s", clnt_sperror(cl, NULL));
143
144
145 /* Spray server with packets */
146 printf ("sending %u packets of lnth %d to %s ...", count, length,
147 *argv);
148 fflush (stdout);
149
150 for (i = 0; i < count; i++) {
150 clnt_call(cl, SPRAYPROC_SPRAY, xdr_sprayarr, &host_array, xdr_void, NULL, ONE_WAY);
151 clnt_call(cl, SPRAYPROC_SPRAY, (xdrproc_t)xdr_sprayarr,
152 &host_array, (xdrproc_t)xdr_void, NULL, ONE_WAY);
151
152 if (delay) {
153 usleep(delay);
154 }
155 }
156
157
158 /* Collect statistics from server */
153
154 if (delay) {
155 usleep(delay);
156 }
157 }
158
159
160 /* Collect statistics from server */
159 if (clnt_call(cl, SPRAYPROC_GET, xdr_void, NULL, xdr_spraycumul, &host_stats, TIMEOUT) != RPC_SUCCESS)
161 if (clnt_call(cl, SPRAYPROC_GET, (xdrproc_t)xdr_void, NULL,
162 (xdrproc_t)xdr_spraycumul, &host_stats, TIMEOUT) != RPC_SUCCESS)
160 errx(1, "%s", clnt_sperror(cl, NULL));
161
162 xmit_time = host_stats.clock.sec +
163 (host_stats.clock.usec / 1000000.0);
164
165 printf ("\n\tin %.2f seconds elapsed time\n", xmit_time);
166
167

--- 50 unchanged lines hidden ---
163 errx(1, "%s", clnt_sperror(cl, NULL));
164
165 xmit_time = host_stats.clock.sec +
166 (host_stats.clock.usec / 1000000.0);
167
168 printf ("\n\tin %.2f seconds elapsed time\n", xmit_time);
169
170

--- 50 unchanged lines hidden ---