Posted to tcl by dodobrain at Thu Jun 13 05:31:51 GMT 2019view raw

  1. #!/usr/bin/expect
  2.  
  3. set timeout 4
  4.  
  5. spawn nc -q 2 127.0.0.1 8888
  6. send "get 123456\r"
  7. expect {
  8. timeout { exit 1 }
  9. "VALUE 123456*\n\{\"number\":\"123456\"*\}*\nEND"
  10. }
  11.  
  12. send "quit\r"