M
Michael C
Hello
Can someone please tell me what I'm doing wrong? I'm writing an application
that should be using callbacks to perform asynchronous calls to the Win32
API. Problem is it never reaches my callback function. Any feedback is
appreciated. Also, any references to websites with examples of .NET async
multithreading would be appreciated. Thanks in advance.
public serverInfo getSession(string servername)
{
serverInfo svInfo;
Object stateObj = new Object();
delGetServer x = new delGetServer(getServer);
IAsyncResult ar = x.BeginInvoke(servername, out svInfo, new
AsyncCallback(finishedProc), stateObj);
return (svInfo);
}
public static void getServer(string servername, out serverInfo svInfo)
{
// performs Win32 API calls to get server info. on network
}
public delegate void delGetServer (string s1, out serverInfo svInfo);
public static void finishedProc(IAsyncResult ar)
{
serverInfo svInfo;
delGetServer temp = (delGetServer)ar.AsyncState;
temp.EndInvoke(out svInfo, ar);
}
Can someone please tell me what I'm doing wrong? I'm writing an application
that should be using callbacks to perform asynchronous calls to the Win32
API. Problem is it never reaches my callback function. Any feedback is
appreciated. Also, any references to websites with examples of .NET async
multithreading would be appreciated. Thanks in advance.
public serverInfo getSession(string servername)
{
serverInfo svInfo;
Object stateObj = new Object();
delGetServer x = new delGetServer(getServer);
IAsyncResult ar = x.BeginInvoke(servername, out svInfo, new
AsyncCallback(finishedProc), stateObj);
return (svInfo);
}
public static void getServer(string servername, out serverInfo svInfo)
{
// performs Win32 API calls to get server info. on network
}
public delegate void delGetServer (string s1, out serverInfo svInfo);
public static void finishedProc(IAsyncResult ar)
{
serverInfo svInfo;
delGetServer temp = (delGetServer)ar.AsyncState;
temp.EndInvoke(out svInfo, ar);
}