2024-05-24 22:03:55 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
// Uncomment this block to pass the first stage
|
2024-05-24 22:46:34 +02:00
|
|
|
"net"
|
|
|
|
"os"
|
2024-05-24 22:03:55 +02:00
|
|
|
)
|
|
|
|
|
2024-05-24 22:56:28 +02:00
|
|
|
func handleConnection(conn net.Conn) {
|
|
|
|
fmt.Fprintf(conn, "HTTP/1.1 200 OK\r\n\r\n")
|
|
|
|
}
|
|
|
|
|
2024-05-24 22:03:55 +02:00
|
|
|
func main() {
|
|
|
|
// You can use print statements as follows for debugging, they'll be visible when running tests.
|
|
|
|
fmt.Println("Logs from your program will appear here!")
|
|
|
|
|
|
|
|
// Uncomment this block to pass the first stage
|
|
|
|
//
|
2024-05-24 22:46:34 +02:00
|
|
|
l, err := net.Listen("tcp", "0.0.0.0:4221")
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Failed to bind to port 4221")
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
2024-05-24 22:56:28 +02:00
|
|
|
for {
|
|
|
|
conn, err := l.Accept()
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Error accepting connection: ", err.Error())
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
go handleConnection(conn)
|
2024-05-24 22:46:34 +02:00
|
|
|
}
|
2024-05-24 22:56:28 +02:00
|
|
|
|
2024-05-24 22:03:55 +02:00
|
|
|
}
|