Golang net/rpc.NewServer(), HandleHTTP() and Accept() functions example
package net/rpc
Golang net/rpc.NewServer() function usage example
server := rpc.NewServer(nil) //<---- here !
httpServerAddr = server.Listener.Addr().String()
fmt.Println(httpServerAddr)
listen, err := net.Listen("tcp", "127.0.0.1:8080")
if err != nil {
panic(err)
}
go server.Accept(listen)
server.HandleHTTP()
References :
http://golang.org/pkg/net/rpc/#Server
Advertisement
Something interesting
Tutorials
+21.2k Golang : How to get time zone and load different time zone?
+9.1k Golang : Simple histogram example
+8.2k Golang : Metaprogramming example of wrapping a function
+22.7k Golang : Strings to lowercase and uppercase example
+7.8k Golang : Scan files for certain pattern and rename part of the files
+7.8k Golang : Example of how to detect which type of script a word belongs to
+14.5k Golang : Overwrite previous output with count down timer
+6.7k Golang : Check if password length meet the requirement
+6.4k PHP : Proper way to get UTF-8 character or string length
+33.8k Golang : convert(cast) bytes to string
+21.2k Golang : How to force compile or remove object files first before rebuild?
+7.1k Golang : Squaring elements in array