Commit 5e5b2a4
Changed files (1)
questioner.go
@@ -7,6 +7,7 @@ import (
"io"
"io/ioutil"
"log"
+ "net/http"
"os"
"strconv"
)
@@ -73,14 +74,18 @@ func LoadConfiguration(cfgFile string) CONFIG {
}
// HandleConnections processes client connections
-func HandleConnections() {
-
+func handleConnections(writer http.ResponseWriter, request *http.Request) {
+ log.Printf("Client Connected: %+v\tvia %+v", request.RemoteAddr, request.UserAgent())
+ io.WriteString(writer, "Welcome to the questioning server.\n")
}
//Listen sets binds the listening server and starts the listening loop
func Listen(serverConfig CONFIG) {
- //bind socket
- //start loop
+ http.HandleFunc("/", handleConnections)
+ log.Fatal(http.ListenAndServe(
+ serverConfig.LISTEN_ADDRESS+":"+
+ strconv.Itoa(serverConfig.LISTEN_PORT),
+ nil))
}
// main handles starting the listening server