I'm trying to figure out whether it's possible to send a tokio::net::TcpStream or a standard std::net::TcpStream to a remote process in Windows.
I figure that I can:
- Get the raw socket for the stream with
as_raw_socket() - Pass it to
WSADuplicateSocket()3 .Send theWSAPROTOCOL_INFOstruct to the remote process - Pass it to
WSASocketto create a socket duplicate in the remote process - Create a
std::net::TcpStreamby passing the returned SOCKET tofrom_raw_socket() - Create a
tokio::net::TcpStreamwithfrom_std()
Does that make any sense?
I tried that and I'm able to get a tokio::net::TcpStream eventually but then when I try sending data on the remote end I'm getting a ConnectionReset error as if the other end (the one which duplicated the socket) has dropped the connection.