github.com/theQRL/go-zond@v0.1.1/p2p/simulations/examples/README.md (about) 1 # devp2p simulation examples 2 3 ## ping-pong 4 5 `ping-pong.go` implements a simulation network which contains nodes running a 6 simple "ping-pong" protocol where nodes send a ping message to all their 7 connected peers every 10s and receive pong messages in return. 8 9 To run the simulation, run `go run ping-pong.go` in one terminal to start the 10 simulation API and `./ping-pong.sh` in another to start and connect the nodes: 11 12 ``` 13 $ go run ping-pong.go 14 INFO [08-15|13:53:49] using sim adapter 15 INFO [08-15|13:53:49] starting simulation server on 0.0.0.0:8888... 16 ``` 17 18 ``` 19 $ ./ping-pong.sh 20 ---> 13:58:12 creating 10 nodes 21 Created node01 22 Started node01 23 ... 24 Created node10 25 Started node10 26 ---> 13:58:13 connecting node01 to all other nodes 27 Connected node01 to node02 28 ... 29 Connected node01 to node10 30 ---> 13:58:14 done 31 ``` 32 33 Use the `--adapter` flag to choose the adapter type: 34 35 ``` 36 $ go run ping-pong.go --adapter exec 37 INFO [08-15|14:01:14] using exec adapter tmpdir=/var/folders/k6/wpsgfg4n23ddbc6f5cnw5qg00000gn/T/p2p-example992833779 38 INFO [08-15|14:01:14] starting simulation server on 0.0.0.0:8888... 39 ```