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
+22.9k Golang : Gorilla mux routing example
+9.9k Golang : Check if user agent is a robot or crawler example
+7.3k Golang : How to fix html/template : "somefile" is undefined error?
+18k Golang : How to log each HTTP request to your web server?
+33.7k Golang : All update packages with go get command
+17.2k Golang : Find file size(disk usage) with filepath.Walk
+22.1k Golang : Join arrays or slices example
+9.4k Golang : How to protect your source code from client, hosting company or hacker?
+8.3k Golang : Auto-generate reply email with text/template package
+19.2k Golang : Delete item from slice based on index/key position
+6.3k PHP : How to handle URI or URL with non-ASCII characters such as Chinese/Japanese/Korean(CJK) ?
+15.2k Golang : Get HTTP protocol version example