We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello Please provide example script for telnet client, which send some strings, then get answer and check it for some conditions? Thank you very much!
The text was updated successfully, but these errors were encountered:
@reejinbouk I found different package, in it provided example script of telnet client. Maybe it will help you: ziutek/telnet
Sorry, something went wrong.
Hello! For example:
package main import ( "github.com/reiver/go-telnet" "fmt" ) // Thin - Connect to thin client func Thin(host string, port string) { if port == "" { port = "23" // Default port } conn, err := telnet.DialTo(host + ":" + port) if err != nil { fmt.Println(err) return } getCommandResult(conn, "echo hello") } func getCommandResult(conn *telnet.Conn, command string) { var shebang string = "#" var shebangCount int = 0 conn.Write([]byte(command + "\n")) a := make([]byte, 0) b := make([]byte, 1) for shebangCount < 2 { _, err := conn.Read(b) if err != nil { fmt.Println(err) } if string(b) == shebang { shebangCount++ } a = append(a, b...) b = make([]byte, 1) } fmt.Println(string(a)) }
It will be return:
echo hello # echo hello hello #
No branches or pull requests
Hello
Please provide example script for telnet client, which send some strings, then get answer and check it for some conditions?
Thank you very much!
The text was updated successfully, but these errors were encountered: