Poll a Connection

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

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

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

fmt.Println(“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

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

I take that back.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.