Search code examples
gotelnet

Telnet client in go


I am trying to send 'hello world' to the telnet server from go client. In the documentation I have found example:

var caller telnet.Caller = telnet.StandardCaller    
telnet.DialToAndCall("localhost:5555", caller)

What is the next step to send 'helloworld' now?


Solution

  • Example of programmatic connection using go-telnet

    func SetTest() {
        conn, _ := telnet.DialTo("localhost:5555")
        conn.Write([]byte("hello world"))
        conn.Write([]byte("\n"))
    
    }