can you add SetConn() method? #67
Unanswered
jicanghaixb
asked this question in
Questions
Replies: 1 comment
-
Hello, you can already do this by overriding DialTimeout - be careful that DialTimeout can be called multiple times if the server redirects the client to another server. func myDialTimeout(network, address string, timeout time.Duration) (net.Conn, error) {
// provide any net.Conn you want
return myConn, nil
}
func main() {
// ClientConf allows to set additional client options
conf := gortsplib.ClientConf{
DialTimeout: myDialTimeout,
}
// connect to the server and start reading all tracks
conn, err := conf.DialRead("rtsp://localhost:8554/mystream")
if err != nil {
panic(err)
}
defer conn.Close()
// read track frames
err = <-conn.ReadFrames(func(trackID int, typ gortsplib.StreamType, buf []byte) {
fmt.Printf("frame from track %d, type %v: %v\n", trackID, typ, buf)
})
panic(err)
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
NetConn() for ClientConn and ServerConn is support, can you add SetConn() method for them? I want to set underlying net.Conn, so I collect socket status. example: Retransmits,Lost.
Beta Was this translation helpful? Give feedback.
All reactions