I need to do some TCP communications in an ASP.net Web App.
I have built a working prototype of my code that communicates to the server using winforms. I would now implement this code into my web app, and I am not sure what the best way would be to do this.
This question is specific to thread life cycle in relation to ASP page life cycles.
I thinking of firing off a thread that does the TCP connection and listening to events from the TCP server.
If I do spawn a thread from my ASP.net web app, what is the lifecycle of this thread? Will it continue to run "orphaned" when the page lifecycle is recreated and a post back, refresh etc? Or will the page somehow clean this up when the life cycle is re-created on postback/refresh?
I wish to run my thread until I want to manually stop it.
I am experimenting with different options, but I would like to get some ideas on the "correct" way to achieve my end result.
(P.S. my thread will update application variables with relevant data coming in from the TCP server). Data to be used across multiple pages in this web app.
My other ideas are to run a standalone desktop app/service to collect the data and merge it into the IIS Application Pool session. (But that is my last resort)