Last active
May 27, 2022 14:51
-
-
Save madflojo/865411055db6f4f6ce432e9892c4d567 to your computer and use it in GitHub Desktop.
TCPClient - Keepalives
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Open TCP Connection | |
c, err := net.DialTCP("tcp", nil, addr) | |
if err != nil { | |
fmt.Printf("Unable to dial to server - %s", err) | |
} | |
// Enable Keepalives | |
err = c.SetKeepAlive(true) | |
if err != nil { | |
fmt.Printf("Unable to set keepalive - %s", err) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment