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
+11k Golang : Generate random elements without repetition or duplicate
+6.5k Golang : Combine slices of complex numbers and operation example
+12.1k Golang : convert(cast) string to integer value
+12.8k Golang : http.Get example
+7.4k Golang : How to detect if a sentence ends with a punctuation?
+9.5k Mac OSX : Get a process/daemon status information
+6.6k Golang : How to determine if request or crawl is from Google robots
+13.7k Golang : Check if an integer is negative or positive
+15.9k Golang : Update database with GORM example
+5.7k Get website traffic ranking with Similar Web or Alexa
+13.3k Golang : Linear algebra and matrix calculation example
+6.9k Mac OSX : Find large files by size