blob: 43ae334810ea9156b64810f39ae0a927f69c3fa6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package main
import (
"flag"
"fmt"
"xgob"
)
var iter *uint = flag.Uint("iter", 1000000, "Number of noops to send to the server")
var wait *bool = flag.Bool("wait", false, "Wait for server to process noops")
func main () {
flag.Parse()
c, _ := xgob.Connect("")
if c.HasError() {
println("Cannot open connection")
return
}
noopRequest := []byte{127, 0, 0, 1}
fmt.Printf("Sending %d noop requests: ", *iter)
for i := uint(0); i < *iter; i++ {
c.WriteNoreplyRequest(noopRequest)
}
c.Flush()
fmt.Println("Done.")
if *wait {
fmt.Print("Waiting for server: ")
gifRequest := []byte{43, 0, 0, 1}
cookie := c.WriteReplyRequest(gifRequest)
c.Flush()
<- cookie
fmt.Println("Done.")
}
}
|