yamux uses its own protocol, it doesn't speak telnet

- sean

On Sat, Aug 20, 2022, 21:31 ramki...@hotmail.com <ramkill...@hotmail.com>
wrote:

> Has anyone ever used a multiplexer <https://github.com/hashicorp/yamux>?
> When creating a TCP server using multiplexer, I get an error [ERR] yamux:
> Invalid protocol version: 102 when using Telnet to connect to the server.
>
> package main
>
> import (
>     "fmt"
>     "net"
>
>     "github.com/hashicorp/yamux"
> )
>
> func main() {
>     server()
> }
>
> func server() {
>
>     listener, _ := net.Listen("tcp", "0.0.0.0:1113")
>     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)
>         }
>         fmt.Println("DPOO")
>
>         // Listen for a message
>         buf := make([]byte, 4)
>         stream.Read(buf)
>         stream.Close()
>         session.Close()
>     }
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/0034b133-79c3-47e7-853a-10282a5beed5n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/0034b133-79c3-47e7-853a-10282a5beed5n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGabyPrgTFhN0Meh3ohtrPkJMQjBbBdX48XknNxbRyJy2YXv7Q%40mail.gmail.com.

Reply via email to