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

31 lines
508 B
Go

package main
import (
"bufio"
"fmt"
"github.com/therealfakemoot/go-telnet"
)
type MUDHandler struct {
}
func (mh MUDHandler) ServeTELNET(ctx telnet.Context, w telnet.Writer, r telnet.Reader) {
s := bufio.NewScanner(r)
// s.Split(bufio.ScanWords)
for s.Scan() {
fmt.Printf("Received user input: %q\n", s.Text())
}
}
func main() {
var handler telnet.Handler = MUDHandler{}
err := telnet.ListenAndServe(":5555", handler)
if nil != err {
//@TODO: Handle this error better.
panic(err)
}
}