ivila commented on code in PR #164: URL: https://github.com/apache/incubator-teaclave-trustzone-sdk/pull/164#discussion_r1923269574
########## examples/udp_socket-rs/ta/src/main.rs: ########## @@ -52,17 +53,64 @@ fn destroy() { fn invoke_command(cmd_id: u32, _params: &mut Parameters) -> Result<()> { trace_println!("[+] TA invoke command"); match Command::from(cmd_id) { - Command::Start => { - udp_socket(); - Ok(()) - } + Command::Start => udp_socket(), _ => Err(Error::new(ErrorKind::BadParameters)), } } -fn udp_socket() { - let mut stream = UdpSocket::connect("127.0.0.1", 34254).unwrap(); - stream.write_all(b"[TA]: Hello, Teaclave!").unwrap(); +#[cfg(not(target_os = "optee"))] +fn udp_socket() -> Result<()> { + use alloc::string::String; + use alloc::vec::Vec; + use optee_utee::net::Setup; + + let setup = Setup::new_v4("127.0.0.1", 34254)?; + let mut stream = UdpSocket::open(setup).map_err(|err| { Review Comment: Changes made, but I split them into three traits in case we only need the `connect` method at times and want to avoid conflicts with other `Read/Write` traits (for example, the `io::{Read, Write}` in `http_io`). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@teaclave.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@teaclave.apache.org For additional commands, e-mail: dev-h...@teaclave.apache.org