File: server.go

package info (click to toggle)
golang-github-chzyer-readline 1.4.39.g2972be2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 304 kB
  • sloc: makefile: 6
file content (26 lines) | stat: -rw-r--r-- 417 bytes parent folder | download | duplicates (6)
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
package main

import (
	"fmt"

	"github.com/chzyer/readline"
)

func main() {
	cfg := &readline.Config{
		Prompt: "readline-remote: ",
	}
	handleFunc := func(rl *readline.Instance) {
		for {
			line, err := rl.Readline()
			if err != nil {
				break
			}
			fmt.Fprintln(rl.Stdout(), "receive:"+line)
		}
	}
	err := readline.ListenRemote("tcp", ":12344", cfg, handleFunc)
	if err != nil {
		println(err.Error())
	}
}