aboutsummaryrefslogtreecommitdiff
path: root/app/main.go
blob: 36c851936725f40a4a958e1284d735047d8913ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main

import (
	"fmt"
	// Uncomment this block to pass the first stage
	// "net"
)

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
	//
	// udpAddr, err := net.ResolveUDPAddr("udp", "127.0.0.1:2053")
	// if err != nil {
	// 	fmt.Println("Failed to resolve UDP address:", err)
	// 	return
	// }
	//
	// udpConn, err := net.ListenUDP("udp", udpAddr)
	// if err != nil {
	// 	fmt.Println("Failed to bind to address:", err)
	// 	return
	// }
	// defer udpConn.Close()
	//
	// buf := make([]byte, 512)
	//
	// for {
	// 	size, source, err := udpConn.ReadFromUDP(buf)
	// 	if err != nil {
	// 		fmt.Println("Error receiving data:", err)
	// 		break
	// 	}
	//
	// 	receivedData := string(buf[:size])
	// 	fmt.Printf("Received %d bytes from %s: %s\n", size, source, receivedData)
	//
	// 	// Create an empty response
	// 	response := []byte{}
	//
	// 	_, err = udpConn.WriteToUDP(response, source)
	// 	if err != nil {
	// 		fmt.Println("Failed to send response:", err)
	// 	}
	// }
}