Monday, March 26, 2012

Multi-threaded/Async methods with Atlas

I've recently started using ASP.NET/Atlas, I've been doing a lot of TCP work in C# with regular Windows Forms applications. All of the work I do with sockets/tcp is Async and I've been trying to get this to work to make a simple TCP Client with a terminal screen in ASP.NET using Atlas. My problem is I understand how to Invoke a delegate in Windows Forms that way you can edit controls created on the UI thread but I'm not sure how to accomplish this in ASP.NET/Atlas. I want to be able to use the Begin* methods of a socket and handle the End* method of them also. I've tried doing this with BeginRead and EndRead however when I try to set the text of a textbox from the other thread nothing happens, I can echo it out to the Debug Output. Is there a way to do this in ASP.NET?

Much thanks,
Chad

Here are a few articles that may help you:

1.http://pluralsight.com/blogs/fritz/archive/2005/02/14/5861.aspx

2.http://msdn.microsoft.com/msdnmag/issues/05/10/WickedCode/


I'll try these out, thanks a lot.

Xtek


After trying this out, I found although while useful not my goal. I'm basically trying to create a live Atlas-enabled TCP terminal. This way the text box can be edited live while the TCP Socket receives/sends data.

Thanks in advance,
Xtek


In that case you have to use some sort of a polling mechanism. You can also use sockets in JavaScript but it is a little tricky. Look at the following:

http://ajaxian.com/archives/true-javascript-sockets

But this requires a flash adapter. I have not used it so I don't have any opinions about it. I will still suggest you to go for polling.


Just what I was looking for, thanks a lot.

Xtek

No comments:

Post a Comment