evio/examples/echo-server/main.go

24 lines
394 B
Go
Raw Normal View History

2017-07-04 06:39:18 +03:00
package main
import (
2017-10-28 03:01:03 +03:00
"log"
2017-07-04 06:39:18 +03:00
2017-10-28 03:01:03 +03:00
"github.com/tidwall/doppio"
2017-07-04 06:39:18 +03:00
)
func main() {
2017-10-28 03:01:03 +03:00
var events doppio.Events
events.Serving = func(wake func(id int) bool) (action doppio.Action) {
log.Print("echo server started on port 5000")
return
}
events.Data = func(id int, in []byte) (out []byte, action doppio.Action) {
out = in
return
}
2017-10-28 22:34:12 +03:00
log.Fatal(doppio.Serve(events, "tcp://0.0.0.0:5000"))
2017-07-04 06:39:18 +03:00
}