diff --git a/src/net/net.rs b/src/net/net.rs index f14c316..4d60287 100644 --- a/src/net/net.rs +++ b/src/net/net.rs @@ -6,7 +6,7 @@ use log::{debug, info}; use smoltcp::{ iface::{ self, Interface, SocketHandle, SocketSet, SocketStorage - }, socket::tcp::{Socket, SocketBuffer, State}, time::Instant, wire::{EthernetAddress, IpAddress, IpCidr, Ipv4Address, Ipv4Cidr} + }, socket::tcp::{Socket, SocketBuffer, State}, time::{Instant, Duration}, wire::{EthernetAddress, IpAddress, IpCidr, Ipv4Address, Ipv4Cidr} }; use stm32_eth::{ Parts, EthPins, PartsIn, @@ -160,6 +160,8 @@ impl ServerHandle { for i in 0..NUM_OF_SOCKETS { let socket = socket_set.get_mut::(tcp_handles[i]); socket.listen(socket_addr).ok(); + socket.set_keep_alive(Some(Duration::from_secs(1))); + socket.set_nagle_enabled(false); } iface.poll(Instant::from_millis(i64::from(sys_timer::now())), &mut &mut dma, &mut socket_set);