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
+27.6k PHP : Convert(cast) string to bigInt
+3.7k Golang : Switch Redis database redis.NewClient
+8k Golang : Get all countries phone codes
+36k Golang : Get file last modified date and time
+10.7k Golang : Interfacing with PayPal's IPN(Instant Payment Notification) example
+7k Golang : Takes a plural word and makes it singular
+6k Golang : Convert Chinese UTF8 characters to Pin Yin
+5.6k Golang : Shortening import identifier
+20.2k Golang : How to get own program name during runtime ?
+8.4k PHP : How to parse ElasticSearch JSON ?
+17.9k Golang : Qt image viewer example
+14.6k Golang : Missing Bazaar command