func serverHandler() { log := logger.Logger{ModuleName: "ServerHandler"} log.Log("Server handler started", logger.InfoVerbosity) listener, err := net.Listen("tcp", PORT) if err != nil { println("Listener failed:", err.Error()) return } for { conn, err := listener.Accept() if err != nil { println("Connection accept failed:", err.Error()) return } go clientHandler(conn) } }
func main() { go serverHandler() log := logger.Logger{ModuleName: "Main"} log.Log("Console started", logger.InfoVerbosity) log.Log("type 'help'", logger.InfoVerbosity) for { var input string fmt.Scanln(&input) switch input { case "help": log.Log("exit - Exit programm", logger.InfoVerbosity) case "exit": log.Log("Exiting...", logger.InfoVerbosity) return default: log.Log("Error: unrecognized command!", logger.InfoVerbosity) } } }