aboutsummaryrefslogtreecommitdiff
path: root/karyons_p2p/examples/net_simulation.sh
blob: 1a05adf56cbe30f758e9407692785a19e4a972df (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash

# build
cargo build --release --example peer 

tmux new-session -d -s karyons_p2p 

tmux send-keys -t karyons_p2p "../../target/release/examples/peer --userid 'peer1'\
    -l 'tcp://127.0.0.1:30000' -d  '30010'" Enter

tmux split-window -h -t karyons_p2p
tmux send-keys -t karyons_p2p "../../target/release/examples/peer --userid 'peer2'\
    -l 'tcp://127.0.0.1:30001' -d  '30011' -b 'tcp://127.0.0.1:30010 ' " Enter

tmux split-window -h -t karyons_p2p
tmux send-keys -t karyons_p2p "../../target/release/examples/peer --userid 'peer3'\
    -l 'tcp://127.0.0.1:30002' -d  '30012' -b 'tcp://127.0.0.1:30010'" Enter

tmux split-window -h -t karyons_p2p
tmux send-keys -t karyons_p2p "../../target/release/examples/peer --userid 'peer4'\
    -l 'tcp://127.0.0.1:30003' -d  '30013' -b 'tcp://127.0.0.1:30010'" Enter

tmux split-window -h -t karyons_p2p
tmux send-keys -t karyons_p2p "../../target/release/examples/peer --userid 'peer5'\
    -l 'tcp://127.0.0.1:30004' -d  '30014' -b 'tcp://127.0.0.1:30010'" Enter

tmux split-window -h -t karyons_p2p
tmux send-keys -t karyons_p2p "../../target/release/examples/peer --userid 'peer6'\
    -l 'tcp://127.0.0.1:30005' -d  '30015' -b 'tcp://127.0.0.1:30010'" Enter

tmux select-layout even-horizontal

sleep 3;

tmux select-pane -t karyons_p2p:0.0

tmux split-window -v -t karyons_p2p
tmux send-keys -t karyons_p2p "../../target/release/examples/peer --userid 'peer7'\
    -b 'tcp://127.0.0.1:30010' -b 'tcp://127.0.0.1:30011'" Enter

tmux select-pane -t karyons_p2p:0.2

tmux split-window -v -t karyons_p2p
tmux send-keys -t karyons_p2p "../../target/release/examples/peer --userid 'peer8'\
    -b 'tcp://127.0.0.1:30010' -b 'tcp://127.0.0.1:30012' -p 'tcp://127.0.0.1:30005'" Enter

tmux select-pane -t karyons_p2p:0.4

tmux split-window -v -t karyons_p2p
tmux send-keys -t karyons_p2p "../../target/release/examples/peer --userid 'peer9'\
    -b 'tcp://127.0.0.1:30010' -b 'tcp://127.0.0.1:30013'" Enter

tmux select-pane -t karyons_p2p:0.6

tmux split-window -v -t karyons_p2p
tmux send-keys -t karyons_p2p "../../target/release/examples/peer --userid 'peer10'\
    -b 'tcp://127.0.0.1:30010' -b 'tcp://127.0.0.1:30014'" Enter

tmux select-pane -t karyons_p2p:0.8

tmux split-window -v -t karyons_p2p
tmux send-keys -t karyons_p2p "../../target/release/examples/peer --userid 'peer11'\
    -b 'tcp://127.0.0.1:30010' -b 'tcp://127.0.0.1:30015'" Enter

tmux select-pane -t karyons_p2p:0.10

tmux split-window -v -t karyons_p2p
tmux send-keys -t karyons_p2p "../../target/release/examples/peer --userid 'peer12'\
    -b 'tcp://127.0.0.1:30010' -b 'tcp://127.0.0.1:30015' -b 'tcp://127.0.0.1:30011'" Enter

# tmux set-window-option -t karyons_p2p synchronize-panes on

tmux attach -t karyons_p2p