> Can  you tell me how I can figure out what it speaks?

Finding that information doesn't appear to be hard:

https://github.com/hashicorp/yamux#specification

"The full specification for Yamux is provided in the spec.md 
<https://github.com/hashicorp/yamux/blob/master/spec.md> file. It can be 
used as a guide to implementors of interoperable libraries."

> Also, by chance do you know of an alternative that would provide multiple 
streams for a connection that happens different protocols or for TCP?

Here are some things you can look at:

* http/2 -- and other protocols which run on top of it, e.g. grpc.
* ssh. You can open multiple sessions over the same connection, and you can 
do TCP port forwarding. The command-line ssh client also supports port 
forwarding using the SOCKS protocol (-D flag).
* message routing protocols like nats.io, nanomsg, zeromq
* SCTP <https://en.wikipedia.org/wiki/Stream_Control_Transmission_Protocol>
* BEEP <https://en.wikipedia.org/wiki/BEEP> (that is very old-school)

It really depends what your application requirements are.  It might be 
simplest for your application to do its own multiplexing.

On Sunday, 21 August 2022 at 04:30:39 UTC+1 ramki...@hotmail.com wrote:

> Also, by chance do you know of an alternative that would provide multiple 
> streams for a connection that happens different protocols or for TCP?
>
> On Saturday, August 20, 2022 at 7:01:00 PM UTC-4 se...@liao.dev wrote:
>
>> yamux uses its own protocol, it doesn't speak telnet
>>
>> - sean
>>
>> On Sat, Aug 20, 2022, 21:31 ramki...@hotmail.com <ramki...@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...@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/f2594668-c4e0-47c1-848f-2261929596e5n%40googlegroups.com.

Reply via email to