Real time

T

Ted Burhan

Hi all,

I'm trying to display a real-time data in one form or another (i.e.
animation/graphic file, or just a text) in asp.net.
The data for the images/text is retrieved from a SQL Server database.

I have a few plans in mind:
- I could have an aspx page that would use GDI+ classes to generate the
graphics and let the page refreshes the images at a regular interval. The
drawback is though, there may be a dozen of images in a single page, which
means that there would be a dozen or so postbacks at every iteration, hence,
demanding a lot of CPU time at the server as well as the client machine.
- I could have a single aspx page that would refresh at a regular interval.
Obviously I will have to have a pre-made images for each possible states.
- Another alternative is to use Flash as it could talk to SQL Server
directly using the Xml objects. Setting up flash movies in an aspx page is
quite tedious job though. While browsing through the net I found several
libaries that could actually let me generate SWF file in .NET, but most of
them are still in Alpha stages, so I'm not very comfortable of using them.

Can anyone please give me a suggestion on what the most efficient way of
doing this is? Maybe somebody has even done this before.

Many thanks
Ted
 
V

Vidar Petursson

Hi

Maybe I don't understand you but for images its not complex
getting only the image not the whole page....

function doIt(newSrc){
var img = new Image();
img.src = newSrc;
img.onload = doDisplay;
img.onerror = errHandler;
}

function doDisplay(){
document.images["imgName"].src = this.src; // imgName is the target img
}

function errHandler(){
// Handle error
}

Obliviously a very basic example...

Preloading images...
function preLoad(){
var a = new Array();
for( i = 0; i < preload.arguments.length; i++ )
{
a[ i ] = new Image();
a[ i ].src = "PATH/" + iPreload.arguments;
}
}

preLoad("img1.gif","img2.gif","img3.jpg");


For text you could use webservices or a hidden iframe to load the data
http://msdn.microsoft.com/downloads...rnet/behaviors/library/webservice/default.asp
DHTML sdk
http://msdn.microsoft.com/library/d...hor/dhtml/reference/dhtml_reference_entry.asp

--
Best Regards
Vidar Petursson
==============================
Microsoft Scripting MVP
http://www.microsoft.com/technet/scriptcenter
==============================
 
T

Ted Burhan

Hi Vidar,

Thank you for replying.
It might help if I explain briefly what I'm trying to achieve.
I have a Windows 2000 server connected to a mining device via some sort of
serial port communication.
The server listens to the port and decypher the incoming data stream from
that serial port and store them in
the appropriate places in the Database (SQL Server 2000). Data frame
generally comes in at around 100ms intervals.
One of the tables in the database is used to represent the current values of
the device attributes
I.e.
tblTagValues
==========
TagID int
Value real

The asp.net application is responsible for reading those "current" tag
values and display them in one form or another
(semaphores/flags, gauges, etc..). I understand that because of the nature
of web brower and internet latency, I may
not be able to achieve real-time presentation of the data, but we can
accomodate sub 5 seconds delay (near real time).
Can you suggest what the best method to achieve this is?

Ted


Vidar Petursson said:
Hi

Maybe I don't understand you but for images its not complex
getting only the image not the whole page....

function doIt(newSrc){
var img = new Image();
img.src = newSrc;
img.onload = doDisplay;
img.onerror = errHandler;
}

function doDisplay(){
document.images["imgName"].src = this.src; // imgName is the target img
}

function errHandler(){
// Handle error
}

Obliviously a very basic example...

Preloading images...
function preLoad(){
var a = new Array();
for( i = 0; i < preload.arguments.length; i++ )
{
a[ i ] = new Image();
a[ i ].src = "PATH/" + iPreload.arguments;
}
}

preLoad("img1.gif","img2.gif","img3.jpg");


For text you could use webservices or a hidden iframe to load the data
http://msdn.microsoft.com/downloads...rnet/behaviors/library/webservice/default.asp
DHTML sdk
http://msdn.microsoft.com/library/d...hor/dhtml/reference/dhtml_reference_entry.asp

--
Best Regards
Vidar Petursson
==============================
Microsoft Scripting MVP
http://www.microsoft.com/technet/scriptcenter
==============================
Ted Burhan said:
Hi all,

I'm trying to display a real-time data in one form or another (i.e.
animation/graphic file, or just a text) in asp.net.
The data for the images/text is retrieved from a SQL Server database.

I have a few plans in mind:
- I could have an aspx page that would use GDI+ classes to generate the
graphics and let the page refreshes the images at a regular interval. The
drawback is though, there may be a dozen of images in a single page, which
means that there would be a dozen or so postbacks at every iteration,
hence,
demanding a lot of CPU time at the server as well as the client machine.
- I could have a single aspx page that would refresh at a regular
interval.
Obviously I will have to have a pre-made images for each possible states.
- Another alternative is to use Flash as it could talk to SQL Server
directly using the Xml objects. Setting up flash movies in an aspx page is
quite tedious job though. While browsing through the net I found several
libaries that could actually let me generate SWF file in .NET, but most of
them are still in Alpha stages, so I'm not very comfortable of using them.

Can anyone please give me a suggestion on what the most efficient way of
doing this is? Maybe somebody has even done this before.

Many thanks
Ted
 
K

Kevin Spencer

Last year we went with the SWF solution. The SWF posted an HTTP Request to
an ASPX page on the server which generated an image, based upon the
parameters sent by the SWF, stored it in a temp folder, and returned the URL
of the image file to the SWF, which then requested the image file. It was
not necessary to dynamically-create the SWF. We simply built a SWF that
behaved as I've described. The only thing dynamically-generated was the
image file.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top