Esempio n. 1
0
func NewTCPListener(port int) net.Listener {
	listener, err := net.Listen("tcp", util.ToPort(port))
	if err != nil {
		log.Fatal(err)
	}
	return listener
}
Esempio n. 2
0
// goroutine responsible for starting the webserver
func Progress(l net.Listener, q chan<- Status, port int) {
	//httpPort := strconv.Itoa(port)

	s := &http.Server{
		Addr:    util.ToPort(port),
		Handler: MyHandler{q},
		//ReadTimeout: 60 * 60 * time.Second,
		WriteTimeout:   40 * time.Second,
		MaxHeaderBytes: 1 << 20,
	}
	//log.Printf("HTTP server listening on port %s\n", httpPort)
	log.Println(s.Serve(l))
}