Created
March 3, 2011 16:47
-
-
Save outworlder/853069 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| import "rpc/jsonrpc" | |
| import "net" | |
| import "time" | |
| type Message struct { | |
| message string | |
| pid int | |
| date time.Time // Eww. | |
| } | |
| func main() { | |
| running := true | |
| socket,_ := net.Listen("tcp", ":9999") | |
| for running { | |
| listener, _ := socket.Accept() | |
| defer socket.Close() | |
| go func() { | |
| fmt.Println("Connection received.") | |
| jsonrpc.ServeConn(listener) | |
| }() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment