Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcp support #4

Open
bacongobbler opened this issue Oct 13, 2021 · 0 comments
Open

tcp support #4

bacongobbler opened this issue Oct 13, 2021 · 0 comments

Comments

@bacongobbler
Copy link
Owner

bacongobbler commented Oct 13, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant