Standard library / net

net.TCPConn.MultipathTCP()

Report whether this established connection uses Multipath TCP. A requested MPTCP connection can fall back to ordinary TCP. This fixture explicitly disables MPTCP. Expected stdout: 'false\n'.

Formal Syntax & Structure

go syntaxgo
func (c *TCPConn) MultipathTCP() (bool, error)

Return Value

(bool, error)

Operation result; check errors and validity indicators when returned.

Working Example

Example Snippetgo
package main
import (  "context"  "fmt"  "net")
func main() {  var lc net.ListenConfig  lc.SetMultipathTCP(false)  l := must(lc.Listen(context.Background(), "tcp4", "127.0.0.1:0"))  defer l.Close()  var d net.Dialer  d.SetMultipathTCP(false)  c := must(d.Dial("tcp4", l.Addr().String()))  defer c.Close()  s := must(l.Accept())  defer s.Close()  fmt.Println(must(c.(*net.TCPConn).MultipathTCP()))}
func must[T any](v T, e error) T {  if e != nil {    panic(e)  }  return v}func check(e error) {  if e != nil {    panic(e)  }}
Go Reference