go3270 is a Golang interface to 3270 terminal emulator.
-
go3270 require x3270 executables in your PATH
-
Go 1.11.x or greater
- v3.3.14ga11
$ go get github.com/msalcantara/go3270
package main
import (
"log"
"github.com/msalcantara/go3270"
)
func main() {
e := go3270.Emulator{
Host: "0.0.0.0",
Port: 992,
}
if err := e.Connect(); err != nil {
log.Fatalf("error to create connection: %v\n", err)
}
if err := e.SetString("my_user"); err != nil {
log.Fatalf("error to set user: %v\n", err)
}
if err := e.Press(go3270.Tab); err != nil {
log.Fatalf("error to press tab: %v\n", err)
}
if err := e.SetString("my_password"); err != nil {
log.Fatalf("error to set password: %v\n", err)
}
if err := e.Press(go3270.Enter); err != nil {
log.Fatalf("error to press enter: %v\n", err)
}
v, err := e.GetValue(0, 1, 4)
if err != nil {
log.Fatalf("error to get value: %v", err)
}
log.Println(v)
if err := e.Disconnect(); err != nil {
log.Fatalf("error to disconnect: %v\n", err)
}
}
go3270 is licensed under the MIT license.