dwrensha/gjio

Access to file descriptor from SocketStream

Closed this issue · 4 comments

Would consider adding an interface (obviously platform-specific) to get access to the file descriptor corresponding to the socket? My application needs to be able to set some options on the socket and it doesn't seem like there's currently any way to access this.

Sounds useful! I suppose it would basically be the reverse of this method.

I'm not sure when I might get around to doing this myself. I'm currently busy porting capnp-rpc-rust from gj to futures-rs.

Exactly. I might put together a PR. The nicest API would seems to be one called unwrap_socket_stream that returns a ::std::net::TcpStream instance. I'm thinking this method should probably be marked unsafe given the potential dangers of exposing this.

Either way, it would be cool if this was something you took into consideration when doing the port :)

In the new version, after the port, you'll be able to use tokio_core::net::TcpStream, which already implements AsRawFd.

Awesome! I'll close tis for now and I'll open up a PR if I do end up implementing this.