If you want a "clean" way, there isn't, as there is no way to pass a
socket handle to a Socket instance and have it work off that.
If possible, what I would do is call the functions in the winsock
library through the P/Invoke layer to get the information about the socket
(type, address family, protocol type) and send the data on a new socket.
However, it seems like you aren't in a position to do that. There is a
private constructor for the Socket class which takes a SafeCloseSocket
instance (an internal class which derives from SafeHandle), all of which you
could access through reflection, but at that point, you are depending on
implementation details, and you could easily get bit by doing such a thing,
especially in this case (reflecting on private constructors that take
internal classes).
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
<ku************@gmail.comwrote in message
news:11*********************@i38g2000prf.googlegro ups.com...
>I have a COM object which returns the socket handle it is currently
connected to as a 32 bit WIN32 handle. I want to send data to this
already connected socket connection but can't seem to figure out what
call i need to make in order to send data using the Win32 handle. Is
this possible?