I need to pass a native winsock socket created by C++ application to a library in my application that uses java.net.Socket to connect to a server.
This Winsock appication already take care of connecting the socket.
How can I explicitly set the socket descriptor of java.net.Socket?
I encountered such a problem on Unix, not sure if the same mechanism works for you with WinSock.
In our case, a program in C creates a socket using special hardware. The C program spawns the Java program passes it the socket. The Java program then constructs input/output stream from the file descriptor of the socket so it can read/write to it just like a normal socket.
The Java code snippet is here,