func sendln(t *telnet.Conn, s string) { checkErr(t.SetWriteDeadline(time.Now().Add(timeout))) buf := make([]byte, len(s)+1) copy(buf, s) buf[len(s)] = '\n' _, err := t.Write(buf) checkErr(err) }
func send(conn *telnet.Conn, s string, timeout time.Duration) error { conn.SetWriteDeadline(time.Now().Add(timeout)) buf := make([]byte, len(s)+1) copy(buf, s) buf[len(s)] = '\n' _, err := conn.Write(buf) if err != nil { return err } return nil }
func (t *TelnetConfig) writeCmd(tn *telnet.Conn, s string) (err error) { buf := make([]byte, len(s)+1) copy(buf, s) buf[len(s)] = '\n' _, err = tn.Write(buf) if err != nil { return err } return nil }
func sendln(t *telnet.Conn, s string) (err error) { err = t.SetWriteDeadline(time.Now().Add(timeout)) if err != nil { return err } buf := make([]byte, len(s)+1) copy(buf, s) buf[len(s)] = '\n' _, err = t.Write(buf) if err != nil { return err } return nil }