Poll a Connection

(Chris) #1

Let’s say I have a simple tls dial happening:

conn, err := tls.Dial(“tcp”,

After this dial, I have a for loop printing “connected”:


How can I make sure the initial tls.Dial is still active? Is there a way to specify a timeout threshold? I’d like to have an if statement, something like:

if conn fails; tls.Close

(Chris) #2

I think I answered my own question. I can use: https://golang.org/pkg/net/#Dialer

(Chris) #3

I take that back.