You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
1.1KB

  1. #!/bin/bash
  2. xterm -geometry +0+0 -e './node 127.0.0.1 2002 2001 1 3001' &
  3. xterm -geometry +500+0 -e './node 127.0.0.1 2003 2002 2 3002' &
  4. xterm -geometry +1000+0 -e './node 127.0.0.1 2001 2003 3 3003' &
  5. sleep 1s
  6. (echo "subscribe 2 4012" | netcat 127.0.0.1 3001 ; echo 1 → 2) &
  7. (echo "subscribe 3 4013" | netcat 127.0.0.1 3001 ; echo 1 → 3) &
  8. (echo "subscribe 1 4021" | netcat 127.0.0.1 3002 ; echo 2 → 1) &
  9. (echo "subscribe 3 4023" | netcat 127.0.0.1 3002 ; echo 2 → 3) &
  10. (echo "subscribe 1 4031" | netcat 127.0.0.1 3003 ; echo 3 → 1) &
  11. (echo "subscribe 2 4032" | netcat 127.0.0.1 3003 ; echo 3 → 2) &
  12. wait %4 %5 %6 %7 %8 %9
  13. xterm -T '1 → 2' -geometry +0+378 -e 'netcat 127.0.0.1 4012' &
  14. xterm -T '1 → 3' -geometry +0+750 -e 'netcat 127.0.0.1 4013' &
  15. xterm -T '2 → 1' -geometry +500+378 -e 'netcat 127.0.0.1 4021' &
  16. xterm -T '2 → 3' -geometry +500+750 -e 'netcat 127.0.0.1 4023' &
  17. xterm -T '3 → 1' -geometry +1000+378 -e 'netcat 127.0.0.1 4031' &
  18. xterm -T '3 → 2' -geometry +1000+750 -e 'netcat 127.0.0.1 4032' &
  19. wait %4 %5 %6 %7 %8 %9