1
0
mirror of https://github.com/MADTeacher/go_basics.git synced 2025-11-23 21:34:47 +02:00

Глава 8

Допричесать игру
This commit is contained in:
Stanislav Chernyshev
2025-06-22 21:04:23 +03:00
parent b895709c86
commit d4e7211d1d
41 changed files with 1724 additions and 143 deletions

38
part_8/8.2/tcp/main.go Normal file
View File

@@ -0,0 +1,38 @@
package main
import (
"fmt"
"log"
"os"
"strconv"
"udp/server/client"
"udp/server/server"
)
const PORT = 8081
func checkErr(err error) {
if err != nil {
log.Fatal(err)
}
}
func main() {
if len(os.Args) != 2 {
fmt.Println("You didn't select a launch option!!!")
return
}
numGR, err := strconv.Atoi(os.Args[1])
checkErr(err)
switch numGR {
case 1:
fmt.Println("Server is running")
server.RunServer(PORT)
case 2:
fmt.Println("Client is running")
client.RunClient(PORT)
default:
log.Fatal("What pokemon is this?")
}
}