Skip to content
forked from ehang-io/nps-mux

A net connection multiplexing implementation based on golang

License

Notifications You must be signed in to change notification settings

asdlei99/nps-mux

 
 

Repository files navigation

nps-mux

A net connection multiplexing implementation base on golang

Key feature:

  • Code division
  • Conn interface implements
  • Lock free queue
  • Slide window
  • Tcp, Kcp reliable stream connection based on

Usage

  1. Dial or Accept a net.Conn, tcp or kcp

    • client: c_client := net.Dial("tcp", "127.0.0.1:8024")
    • server: listener, err := net.Listen("tcp", "127.0.0.1:8024") c_server, err := listener.Accept()
  2. Make connection to mux connection

    • client: mux_client := nps_mux.NewMux(c_client, "tcp")
    • server: mux_server := nps_mux.NewMux(c_server, "tcp")
  3. You can handle new connections both side, like this

    • client: newConn, err := mux_client.Accept()
    • server: clientConn, err := mux_server.NewConn()

newConn and clientConn are transfer data though mux connection

You can use Read Write method to transfer your own data

More

See mux_test.go

About

A net connection multiplexing implementation based on golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%