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

[Proposal] Implement missing functions. #51

Open
MediosZ opened this issue May 13, 2022 · 2 comments
Open

[Proposal] Implement missing functions. #51

MediosZ opened this issue May 13, 2022 · 2 comments

Comments

@MediosZ
Copy link
Contributor

MediosZ commented May 13, 2022

There are many functions need to implemented for TcpListener and TcpStream.
We need to implement as many as possible, so that wasmedge_wasi_socket can be a substitute of std version.

Here is the list of them:

TcpListener:

fn local_addr(&self) -> io::Result<SocketAddr>;
fn try_clone(&self) -> io::Result<TcpListener>;
fn set_ttl(&self, ttl: u32) -> io::Result<()>;
fn ttl(&self) -> io::Result<u32>;
fn take_error(&self) -> io::Result<Option<io::Error>>;
fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()>;

TcpStream:

fn connect_timeout(addr: &SocketAddr, timeout: Duration) -> io::Result<TcpStream>;
fn try_clone(&self) -> io::Result<TcpStream>;
fn set_ttl(&self, ttl: u32) -> io::Result<()>;
fn ttl(&self) -> io::Result<u32>;
fn take_error(&self) -> io::Result<Option<io::Error>>;
fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()>;
fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()>;
fn read_timeout(&self) -> io::Result<Option<Duration>>;
fn write_timeout(&self) -> io::Result<Option<Duration>>;
fn peek(&self, buf: &mut [u8]) -> io::Result<usize>;
fn set_nodelay(&self, nodelay: bool) -> io::Result<()>;
fn nodelay(&self) -> io::Result<bool>;
fn set_linger(&self, linger: Option<Duration>) -> io::Result<()>;
fn linger(&self) -> io::Result<Option<Duration>>;
@L-jasmine
Copy link
Contributor

TcpListener:

fn local_addr(&self) -> io::Result<SocketAddr>; // ok
fn try_clone(&self) -> io::Result<TcpListener>; // ok
fn set_ttl(&self, ttl: u32) -> io::Result<()>; // not supported now,but I think it is not a core feature. I will implement an empty api.
fn ttl(&self) -> io::Result<u32>; // 
fn take_error(&self) -> io::Result<Option<io::Error>>; // ok
fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()>; // ok

TcpStream:

fn connect_timeout(addr: &SocketAddr, timeout: Duration) -> io::Result<TcpStream>; // ok
fn try_clone(&self) -> io::Result<TcpStream>; // ok
fn set_ttl(&self, ttl: u32) -> io::Result<()>; //  implement an empty api.
fn ttl(&self) -> io::Result<u32>; //
fn take_error(&self) -> io::Result<Option<io::Error>>; // ok
fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()>; // ok
fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()>; // ok
fn read_timeout(&self) -> io::Result<Option<Duration>>; // ok
fn write_timeout(&self) -> io::Result<Option<Duration>>; // ok
fn peek(&self, buf: &mut [u8]) -> io::Result<usize>; // ok
fn set_nodelay(&self, nodelay: bool) -> io::Result<()>; //  implement an empty api.
fn nodelay(&self) -> io::Result<bool>; // 
fn set_linger(&self, linger: Option<Duration>) -> io::Result<()>; // ok
fn linger(&self) -> io::Result<Option<Duration>>; // ok

@MediosZ
Copy link
Contributor Author

MediosZ commented May 13, 2022

I am willing to help.

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

2 participants