Project creation; initial screen send capability

This commit is contained in:
Matthew R. Wilson committed 2020-11-02 01:00:30 -08:00
commit 0243fc3e13
8 files changed
+333

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
// This file is part of https://github.com/racingmars/go3270/
// Copyright 2020 by Matthew R. Wilson, licensed under the MIT license. See
// LICENSE in the project root for license information.
package go3270
import "io"
// NegotiateTelnet will naively (e.g. not checking client responses) negotiate
// the options necessary for tn3270 on a new telnet connection, conn.
func NegotiateTelnet(conn io.ReadWriter) error {
rbuf := make([]byte, 255)
conn.Write([]byte{0xff, 0xfd, 0x18}) // DO TermType
conn.Read(rbuf)
conn.Write([]byte{0xff, 0xfa, 0x18, 0x01, 0xff, 0xf0}) // TermType suboptions
conn.Read(rbuf)
conn.Write([]byte{0xff, 0xfd, 0x19}) // DO EOR
conn.Read(rbuf)
conn.Write([]byte{0xff, 0xfd, 0x00}) // DO Binary
conn.Read(rbuf)
conn.Write([]byte{0xff, 0xfb, 0x19, 0xff, 0xfb, 0x00}) // WILL binary, eor
conn.Read(rbuf)
return nil
}