Golang net.DialTCP() function example
package net
Golang net.DialTCP() function usage example
target := "127.1.0.1:8080"
raddr,e := net.ResolveTCPAddr("tcp",target)
if err != nil {
fmt.Println(err)
return 1
}
conn, err := net.DialTCP("tcp",nil,raddr)
if err != nil {
fmt.Println(err)
return 1
}
localAddr := conn.LocalAddr()
fmt.Println(localAddr)
References :
Advertisement
Something interesting
Tutorials
+9.9k Golang : Turn string or text file into slice example
+25.3k Golang : Get current file path of a file or executable
+10.3k Golang : How to check if a website is served via HTTPS
+5.2k PHP : See installed compiled-in-modules
+6.5k Golang : Convert an executable file into []byte example
+8.6k Golang : Set or add headers for many or different handlers
+7.7k Golang : How to execute code at certain day, hour and minute?
+8.5k Golang : How to check variable or object type during runtime?
+11.5k Use systeminfo to find out installed Windows Hotfix(s) or updates
+14.5k Golang : How to determine if user agent is a mobile device example
+36.5k Golang : Save image to PNG, JPEG or GIF format.
+9.2k Golang : How to find out similarity between two strings with Jaro-Winkler Distance?