Created
November 20, 2025 16:41
-
-
Save jaysonsantos/4a32329b8c3d284d1d4d2d2cf99fb3b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| const net = std.net; | |
| pub fn main() !void { | |
| const address = try net.Address.parseIpAndPort("1.1.1.1:80"); | |
| const host_name = "1.1.1.1"; | |
| var stream = try std.net.tcpConnectToAddress(address); | |
| var buffer: [1024]u8 = undefined; | |
| const writer = stream.writer(&buffer); | |
| var output = writer.interface; | |
| try output.print("GET / HTTP/1.0\r\nHost: {s}\r\n\r\n", .{host_name}); | |
| try output.flush(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| thread 1852807 panic: reached unreachable code | |
| /nix/store/60r66ghylp151rz650srgf3f863sslrv-zig-0.15.2/lib/zig/std/posix.zig:6176:26: 0x100c9ed5b in sendmsg (main) | |
| .BADF => unreachable, // always a race condition | |
| ^ | |
| /nix/store/60r66ghylp151rz650srgf3f863sslrv-zig-0.15.2/lib/zig/std/net.zig:2298:50: 0x100c9d8fb in drain (main) | |
| return io_w.consume(posix.sendmsg(w.file_writer.file.handle, &msg, flags) catch |err| { | |
| ^ | |
| /nix/store/60r66ghylp151rz650srgf3f863sslrv-zig-0.15.2/lib/zig/std/Io/Writer.zig:316:39: 0x100c1a6df in defaultFlush (main) | |
| while (w.end != 0) _ = try drainFn(w, &.{""}, 1); | |
| ^ | |
| /nix/store/60r66ghylp151rz650srgf3f863sslrv-zig-0.15.2/lib/zig/std/Io/Writer.zig:310:26: 0x100c3a08f in flush (main) | |
| return w.vtable.flush(w); | |
| ^ | |
| /private/tmp/http-test/src/main.zig:14:21: 0x100c995eb in main (main) | |
| try output.flush(); | |
| ^ | |
| /nix/store/60r66ghylp151rz650srgf3f863sslrv-zig-0.15.2/lib/zig/std/start.zig:627:37: 0x100c9a4cb in main (main) | |
| const result = root.main() catch |err| { | |
| ^ | |
| ???:?:?: 0x1936b5d53 in ??? (???) | |
| ???:?:?: 0x0 in ??? (???) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment