This repository has been archived on 2024-03-23. You can view files and clone it, but cannot push or open issues or pull requests.
ambition-legacy/backend/main.go

39 lines
621 B
Go
Raw Normal View History

package main
import (
"log"
"net"
"os"
)
const (
serverAddress = "localhost:7764"
)
func main() {
log.Println("Ambition going strong at", serverAddress)
listener, err := net.Listen("tcp", serverAddress)
if err != nil {
log.Fatalln("Failed to initialise TCP listener", err)
}
defer listener.close()
for {
conn, err := listener.Accept()
if err != nil {
log.Println("Failed to accept connection:", err)
continue
}
// Concurrency FTW
go handleConnection(conn)
}
}
func handleConnection(conn net.Conn) {
defer conn.Close()
// TODO implement actual server. Waiting on frontend for this
}