diff --git a/ctru-rs/examples/network-sockets.rs b/ctru-rs/examples/network-sockets.rs index 2172d81..ac8953d 100644 --- a/ctru-rs/examples/network-sockets.rs +++ b/ctru-rs/examples/network-sockets.rs @@ -4,7 +4,7 @@ use ctru::services::apt::Apt; use ctru::services::hid::{Hid, KeyPad}; use ctru::services::soc::Soc; -use std::io::{Read, Write}; +use std::io::{self, Read, Write}; use std::net::{Shutdown, TcpListener}; use std::time::Duration; @@ -37,7 +37,13 @@ fn main() { let req_str = String::from_utf8_lossy(&buf); println!("{}", req_str); } - Err(e) => println!("Unable to read stream: {}", e), + Err(e) => { + if e.kind() == io::ErrorKind::WouldBlock { + println!("Note: Reading the connection returned ErrorKind::WouldBlock.") + } else { + println!("Unable to read stream: {}", e) + } + }, } let response = b"HTTP/1.1 200 OK\r\nContent-Type: text/html; charset=UTF-8\r\n\r\nHello world\r\n";