views:

63

answers:

1

Hi, I am sorry for the title but I really do not know how to better describe it. I am using threadpool for processing incoming data on the server side and in one method I would need to call static method asynchronously but I am not sure how to do that.

When server receives the data from client, it uses threadpool:

System.Threading.ThreadPool.QueueUserWorkItem(c.ReadData);

In the c.ReadData I would need to call static method which result is not important (sends some data to website) and I dont need to know it. I am just not sure what is the best solution here. Thank you!

+2  A: 

You can use the HttpWebRequest class to programmatially make a request to a resource via HTTP. Put a call to this method in your method that you're passing into QueueUserWorkItem.

pmarflee
Yes I am using that but it takes too long, that is why I need to run asynchronously.
Tomas
@Tomas: QueueUserWorkItem is asynchronous. The action is queued until a thread becomes available from the thread pool to service it. If you want the code that specifically makes the web request run asynchronously, you should look at the BeginGetRequestStream and EndGetRequestStream methods of the HttpWebRequest class.
pmarflee