func main() { endpoint := "127.0.0.1:19091" c := install_signal() host, err := enet.NewHost(endpoint) panic_if_error(err) host.SetDataHandler(pong) host.SetConnectionHandler(on_peer_connected) host.SetDisconnectionHandler(on_peer_disconnected) host.Run(c) }
func main() { endpoint := "127.0.0.1:19091" c := install_signal() host, err := enet.NewHost("") panic_if_error(err) host.SetDataHandler(ping_on_reliable) host.SetConnectionHandler(ping_on_connect) host.SetDisconnectionHandler(func(enet.Host, string, int) { host.Stop() }) host.Connect(endpoint) host.Run(c) }