Golang net.Listen() function example
package net
Golang net.Listen() function usage example
package main
import (
"fmt"
"log"
"net"
)
....
func main() {
ln, err := net.Listen("tcp", ":6000")
if err != nil {
log.Fatal(err)
}
fmt.Println("Server up and listening on port 6000")
for {
conn, err := ln.Accept()
if err != nil {
log.Println(err)
continue
}
go handleConnection(conn)
}
}
See full example at :
https://www.socketloop.com/tutorials/golang-simple-client-server-example
References :
Advertisement
Something interesting
Tutorials
+7.2k Golang : Check if one string(rune) is permutation of another string(rune)
+20.8k Golang : Underscore or snake_case to camel case example
+12k Golang : Find and draw contours with OpenCV example
+9.2k Golang : How to check if a string with spaces in between is numeric?
+9.9k Golang : Sort and reverse sort a slice of integers
+6.8k Unix/Linux : How to fix CentOS yum duplicate glibc or device-mapper-libs dependency error?
+9.2k nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
+39.2k Golang : How to read CSV file
+22.1k Golang : Join arrays or slices example
+6.1k Golang : Debug with Godebug
+9.2k Golang : How to find out similarity between two strings with Jaro-Winkler Distance?
+20.6k Golang : Secure(TLS) connection between server and client