bevy_simple_networking
bevy_simple_networking copied to clipboard
tcp support
There should be a way to support TCP connections. At the moment, both the *_recv_packet_system
and send_packet_system
both rely on a UdpSocket
resource being present. We could split this out as a trait:
pub trait Socket {
fn recv(&self, &mut [u8]) -> io::Result<(usize, SocketAddr)>;
fn send(&self, buf: &[u8], addr: SocketAddr) -> io::Result<usize>;
}
Then use the trait in both systems so that we can swap out a UdpSocket
for a TcpListener
.