|
1 | | -@@ -1,22 +1,17 @@ |
| 1 | +@@ -1,20 +1,15 @@ |
2 | 2 | const std = @import("std"); |
3 | 3 | -// Uncomment this block to pass the first stage |
4 | 4 | -// const net = std.net; |
|
9 | 9 |
|
10 | 10 | - // You can use print statements as follows for debugging, they'll be visible when running tests. |
11 | 11 | - try stdout.print("Logs from your program will appear here!\n", .{}); |
12 | | -- |
13 | | -- // Uncomment this block to pass the first stage |
14 | | -- // const address = try net.Address.resolveIp("127.0.0.1", 4221); |
15 | 12 | + const address = try net.Address.resolveIp("127.0.0.1", 4221); |
| 13 | ++ var listener = try address.listen(.{ |
| 14 | ++ .reuse_address = true, |
| 15 | ++ }); |
| 16 | ++ defer listener.deinit(); |
16 | 17 |
|
17 | | - // var listener = try address.listen(.{ |
18 | | - // .reuse_address = true, |
19 | | - // }); |
20 | | - // defer listener.deinit(); |
21 | | - |
22 | | - // const connection = try listener.accept(); |
23 | | - // try stdout.print("accepted new connection", .{}); |
24 | | - // connection.stream.close(); |
| 18 | +- // Uncomment this block to pass the first stage |
| 19 | +- // const address = try net.Address.resolveIp("127.0.0.1", 4221); |
| 20 | +- // var listener = try address.listen(.{ |
| 21 | +- // .reuse_address = true, |
| 22 | +- // }); |
| 23 | +- // defer listener.deinit(); |
| 24 | +- // |
| 25 | +- // _ = try listener.accept(); |
| 26 | +- // try stdout.print("client connected!", .{}); |
| 27 | ++ _ = try listener.accept(); |
| 28 | ++ try stdout.print("client connected!", .{}); |
25 | 29 | } |
0 commit comments