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_INFO
struct to the remote process - Pass it to
WSASocket
to create a socket duplicate in the remote process - Create a
std::net::TcpStream
by passing the returned SOCKET tofrom_raw_socket()
- Create a
tokio::net::TcpStream
withfrom_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.