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
417 B

  1. package main
  2. import (
  3. "fmt"
  4. "github.com/chzyer/readline"
  5. )
  6. func main() {
  7. cfg := &readline.Config{
  8. Prompt: "readline-remote: ",
  9. }
  10. handleFunc := func(rl *readline.Instance) {
  11. for {
  12. line, err := rl.Readline()
  13. if err != nil {
  14. break
  15. }
  16. fmt.Fprintln(rl.Stdout(), "receive:"+line)
  17. }
  18. }
  19. err := readline.ListenRemote("tcp", ":12344", cfg, handleFunc)
  20. if err != nil {
  21. println(err.Error())
  22. }
  23. }