diff --git a/cmd/Server.go b/cmd/Server.go index 7b63831..df5d698 100644 --- a/cmd/Server.go +++ b/cmd/Server.go @@ -2,6 +2,8 @@ package cmd // code.bitsetter.de/fun/gosl/cmd import ( "fmt" + "log" + "net" "github.com/spf13/cobra" @@ -15,8 +17,31 @@ var cmdServer = &cobra.Command{ // Run: } +func handleConn(conn *net.TCPConn) { + log.Println("Got a connection!") + conn.Close() + +} + func runServer(cmd *cobra.Command, args []string) { fmt.Println("running server ...") + + listener, err := net.ListenTCP("tcp", &net.TCPAddr{Port: 8989}) + if err != nil { + log.Fatal(err) + panic("Could not open Listener") + } + defer listener.Close() + for { + conn, err := listener.AcceptTCP() + if err != nil { + log.Fatal(err) + panic("Listener could not accept connection!") + } + + go handleConn(conn) + } + data.TestNC() } diff --git a/gosl b/gosl index cb5f58e..a9e599d 100755 Binary files a/gosl and b/gosl differ