Example #1
0
func listenTelnet(addr string) {
	telnetServer := telnet.Server{Addr: addr, Handler: handleTelnet}

	log.Printf("serving telnet on TCP %s", addr)

	if err := telnetServer.ListenAndServe(); err != nil {
		log.Fatalf("telnet server on address %s: error: %s", addr, err)
	}
}
Example #2
0
func ListenTelnet(addr string, cliServer *Server) {

	handler := func(conn net.Conn) {
		handleTelnet(conn, cliServer)
	}

	telnetServer := telnet.Server{Addr: addr, Handler: handler}

	log.Printf("serving telnet on TCP %s", addr)

	if err := telnetServer.ListenAndServe(); err != nil {
		log.Fatalf("telnet server on address %s: error: %s", addr, err)
	}
}