I am attempting to make a simple Online-Terminal Messenger to dip my toes into networking. I am getting this error when I try to call "read" on a reader from a stream of a Server. Ignoring some simple helper functions (That I will Attach later) My code is this :
const std = @import("std");
const net = std.net;
pub fn main() !void {
print("Test 1\n");
const stdin = std.io.getStdIn().reader();
const receiving_on = try net.Address.parseIp("127.0.0.1", 2335);
printf("You are receiving on : {any}\n", .{receiving_on});
print("Please Provide an IP Address :\n");
var ip_buf : [20] u8 = undefined;
const ip = try input_to_buf(stdin, &ip_buf) orelse return;
print("Please Provide a Port\n");
var port_buf : [10] u8 = undefined;
const port_str = try input_to_buf(stdin, &port_buf) orelse return;
const port = try std.fmt.parseInt(u16, port_str, 10);
const address = try net.Address.parseIp(ip, port);
_ = address;
var reception_desk = try receiving_on.listen(.{});
defer reception_desk.deinit();
var reception_inbox = reception_desk.stream.reader();
var inp_buf : [252]u8 = undefined;
var msg_buf : [250]u8 = undefined;
var msg_active : usize = 0;
while (true) {
print("What is your input? -r-eceive? or -s-end?\n");
const msg = try input_to_buf(stdin, &inp_buf) orelse continue;
if (str_eql(msg, "off", false)) break;
if ( str_eql(msg, "r", false) ) {
print("Attempting to receive\n");
msg_active = try reception_inbox.read(&msg_buf);
printf("Msg Received : -{s}-\n", .{msg_buf[0..msg_active]});
} else if ( str_eql(msg, "s", false) ) {
print("Attempting to send\n");
}
}
}