I don't think I fully understand something. I telnet to code below but I get the error [ERR] yamux: Invalid protocol version: 102. What exactly is wrong?
Here is my code
import (
"net"
"github.com/hashicorp/yamux"
)
func main() {
server()
}
func server() {
listener, _ := net.Listen("tcp", "0.0.0.0:1234")
for {
// Accept a TCP connection
conn, err := listener.Accept()
if err != nil {
panic(err)
}
// Setup server side of smux
session, err := yamux.Server(conn, nil)
if err != nil {
panic(err)
}
// Accept a stream
stream, err := session.Accept()
if err != nil {
panic(err)
}
// Listen for a message
buf := make([]byte, 4)
stream.Read(buf)
stream.Close()
session.Close()
}
}
I don't think I fully understand something. I telnet to code below but I get the error
[ERR] yamux: Invalid protocol version: 102
. What exactly is wrong?Here is my code