From 5f1e6815cda90be7bd838a03cb36c582c0cb730d Mon Sep 17 00:00:00 2001 From: pomid Date: Sat, 14 Oct 2023 17:38:26 +0330 Subject: [PATCH] examples: fix net_udp_server_and_client.v with latest V and latest `net` module (listen on 0.0.0.0, and dial to 127.0.0.1) (#19564) --- examples/net_udp_server_and_client.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/net_udp_server_and_client.v b/examples/net_udp_server_and_client.v index 426b8c3048..e47eaa7c5c 100644 --- a/examples/net_udp_server_and_client.v +++ b/examples/net_udp_server_and_client.v @@ -12,7 +12,7 @@ fn main() { mut buf := []u8{len: 100} if is_server { println('UDP echo server, listening for udp packets on port: ${port}') - mut c := net.listen_udp(':${port}')! + mut c := net.listen_udp('0.0.0.0:${port}')! for { read, addr := c.read(mut buf) or { continue } println('received ${read} bytes from ${addr}') @@ -23,7 +23,7 @@ fn main() { } } else { println('UDP client, sending packets to port: ${port}.\nType `exit` to exit.') - mut c := net.dial_udp('localhost:${port}')! + mut c := net.dial_udp('127.0.0.1:${port}')! for { mut line := os.input('client > ') match line {