solomon_13000
02-14-2007, 10:01 PM
I am interested to queue up any number of video files before storing it to the server folder. How can I accomplish this using asp.net 2.0 with C#?
|
Click to See Complete Forum and Search --> : Queue solomon_13000 02-14-2007, 10:01 PM I am interested to queue up any number of video files before storing it to the server folder. How can I accomplish this using asp.net 2.0 with C#? Ribeyed 02-15-2007, 04:07 AM You can achieve this using Asynchronous calling. Private Delegate Function TimeConsumingTask(ByVal seconds As Integer) As Integer 'The WaitAll() method must execute on a MTA thread. <MTAThread()> Public Sub Main() 'Dim ResultA, ResultB, ResultC As Integer 'Define and start three tasks. Dim AsyncInvoker As New TimeConsumingTask(AddressOf Delay) Dim AsyncResultA, AsyncResultB, AsyncResultC As IAsyncResult AsyncResultA = AsyncInvoker.BeginInvoke(10, Nothing, Nothing) AsyncResultB = AsyncInvoker.BeginInvoke(30, Nothing, Nothing) AsyncResultC = AsyncInvoker.BeginInvoke(15, Nothing, Nothing) Response.Write("Call A is: " & AsyncResultA.IsCompleted.ToString() & "<BR>") Response.Write("Call B is: " & AsyncResultB.IsCompleted.ToString() & "<BR>") Response.Write("Call C is: " & AsyncResultC.IsCompleted.ToString() & "<BR>") Dim WaitHandles() As Threading.WaitHandle = {AsyncResultA.AsyncWaitHandle, AsyncResultB.AsyncWaitHandle, AsyncResultC.AsyncWaitHandle} Threading.WaitHandle.WaitAll(WaitHandles) Response.Write("Call A is: " & AsyncResultA.IsCompleted.ToString() & "<BR>") Response.Write("Call B is: " & AsyncResultB.IsCompleted.ToString() & "<BR>") Response.Write("Call C is: " & AsyncResultC.IsCompleted.ToString()) End Sub Private Function Delay(ByVal Seconds As Integer) As Integer Dim StartTime As DateTime = DateTime.Now Do 'Do Nothing. Loop While DateTime.Now.Subtract(StartTime).TotalSeconds < Seconds Return Seconds End Function End Class solomon_13000 02-15-2007, 06:51 AM from the code I see, where will a file reside before storing it into a folder? Because im planning to upload a file to a queue before storing it into a folder. Ribeyed 02-15-2007, 07:01 AM Never tried it before but i would think it would be held in memory. I would add code for uploading the fill in one handler then do the save command in the last handler to fire. This is only an idea i haven't tried this before myself. let me know how you get on. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |