UInt32 to IntPtr
- by ffenix
I have the following problem:
public class ListenThread : SocketInvoke
{
[DllImport("Ws2_32", CharSet = CharSet.Auto)]
public unsafe static extern UInt32 WSAWaitForMultipleEvents(UInt32 cEvents, IntPtr hEventObject,
UInt32 fWaitAll, UInt32 dwTimeout, Boolean fAlertable);
public void ListenConnections(NetSharedData data)
{
while (true)
{
unsafe
{
if (WSAWaitForMultipleEvents((UInt32)1, data.signal, (UInt32)0, (UInt32)100, false) != WSA_WAIT_TIMEOUT)
{
}
}
}
}
data.signal is a UInt32 how i can cast it to IntPtr?, i try:
IntPtr signal = (IntPtr)data.signal;
but it doesn't work because i need a pointer to data.signal (UInt32) type and not the int value as an pointer, that will make a memory exception.
An C++ example of what i need:
int signal = 0;
int* psignal = &signal;