Improved network code

This commit is contained in:
2024-01-15 17:08:26 +01:00
parent 9b47e374c7
commit b885d70625
17 changed files with 241 additions and 72 deletions

14
server/ping.go Normal file
View File

@ -0,0 +1,14 @@
package main
import (
"fmt"
"server/core"
"server/packet"
)
// ping is used as a heartbeat and latency check.
func ping(data []byte, client *core.Client) {
fmt.Println("1 - ping!")
server.Send(packet.PING, data, client)
fmt.Println(server.Count(), "clients")
}