diff --git a/README.md b/README.md index 9356f25..c8df125 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,9 @@ Below some really basic usage how I am ca using it: if let Ok(Some((ip, port, len))) = (w5500, socket).receive(&mut buffer[..]) { let (request_buffer, response_buffer) = buffer.split_mut_at(len); - //... + // ... fill the response_buffer with some data ... - (w5500, socket).blocking_send(ip, port, 1234, response_buffer[..response_len]).unwrap(); + (w5500, socket).blocking_send(ip, port, response_buffer[..response_len]).unwrap(); } } ``` diff --git a/src/lib.rs b/src/lib.rs index eacab2c..b51ef3f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -351,7 +351,6 @@ pub trait Udp { &mut self, host: &IpAddress, host_port: u16, - local_port: u16, data: &[u8], ) -> Result<(), E>; } @@ -412,12 +411,12 @@ impl Udp for (&mut ActiveW5500<'_, '_, '_, E>, &UdpSocket) { &mut self, host: &IpAddress, host_port: u16, - local_port: u16, data: &[u8], ) -> Result<(), E> { let (w5500, UdpSocket(socket)) = self; { + let local_port = w5500.read_u16(socket.at(SocketRegister::LocalPort))?; let local_port = u16_to_be_bytes(local_port); let host_port = u16_to_be_bytes(host_port);