Make buffer not eat all memory.

This commit is contained in:
2022-01-13 22:20:35 +10:30
parent f872453f16
commit 0261886b43
4 changed files with 144 additions and 66 deletions

View File

@@ -9,6 +9,7 @@ import (
func main() {
log.SetFlags(log.Lshortfile)
port := flag.Int("p", 9000, "Port to run server/client on.")
addr := flag.String("a", "61.245.149.58", "address to connect to.")
isServer := flag.Bool("s", false, "Set if running the server.")
flag.Parse()
@@ -18,7 +19,7 @@ func main() {
s.Run()
} else {
fmt.Printf("Client running on %d\n", *port)
c := Client{port: *port}
c := Client{port: *port, address: *addr}
err := c.Connect()
if err != nil {
fmt.Print(err)