473,471 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Asyncronous/AJAX Suggestions Please!

OJ
Hi,
I have written a small C# 2.0 DLL which acts as a client to a Socket
based server over the internet. I have written both synchronous and
asynchronous methods to connect, send, and receive data from the
server. Each request/response can take upto 180 seconds. I am trying to
use the asyncronous calls in an ASP.NET C# 2.0 Webcontrol, which
displays the returned data. At the moment I am happily using the
asyncronous functions and events in my ASP.NET Usercontrol, but I am
having to block the main ASP.NET thread until the worker threads
dealing with the server response notifies my control that it has
returned all data. Then I render the control with all the returned
data. Obviously this destroys the advantage of the async functions.
There is an event firing in the dll that notifies me when new data has
arrived whilst waiting for all data to return. What I would really like
is to render the page to the client and then asynchronously update the
control from the server with the data that has arrived, before all data
has arrived. Could anybody point me in the right direction to implement
this?

OJ

Sep 21 '06 #1
3 1713
Hi,

OJ wrote:
Hi,
I have written a small C# 2.0 DLL which acts as a client to a Socket
based server over the internet. I have written both synchronous and
asynchronous methods to connect, send, and receive data from the
server. Each request/response can take upto 180 seconds. I am trying to
use the asyncronous calls in an ASP.NET C# 2.0 Webcontrol, which
displays the returned data. At the moment I am happily using the
asyncronous functions and events in my ASP.NET Usercontrol, but I am
having to block the main ASP.NET thread until the worker threads
dealing with the server response notifies my control that it has
returned all data. Then I render the control with all the returned
data. Obviously this destroys the advantage of the async functions.
There is an event firing in the dll that notifies me when new data has
arrived whilst waiting for all data to return. What I would really like
is to render the page to the client and then asynchronously update the
control from the server with the data that has arrived, before all data
has arrived. Could anybody point me in the right direction to implement
this?

OJ
The best way to do what you want is to render the basic HTML "framework"
to the web client, so that the user has something to see instead of a
blank page. Then you use XmlHttpRequest in JavaScript to poll the server.

If you don't want to program the XmlHttpRequest yourself, there are
(too) many AJAX frameworks available. The most well know is prototype,
but JavaScript experts usually recommend against it. One I like is Matt
Kruse's AJAX toolbox
http://www.ajaxtoolbox.com/

Note that programming the XmlHttpRequest is not that difficult,
especially for simple requests.

The server typically sends back text, HTML or XML. It's your task then
to use client-side JavaScript and DOM Level 2 methods to replace nodes
content with the text or HTML returned from the server, or to use the
XML content.

Please feel free to ask more if you have more questions (you'll probably
have), this is just a short intro to AJAX.

Greetings,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Sep 21 '06 #2
OJ
Hi Laurent,
I appreciate the time you have taken to reply. I will take a look at
the site you recommended. To be honest, I too was swamped by AJAX/ATLAS
stuff when I was trying to find out about this technique...

Perhaps my next post on this subject will be in the Javascript
group.....

O
Laurent Bugnion wrote:
Hi,

OJ wrote:
Hi,
I have written a small C# 2.0 DLL which acts as a client to a Socket
based server over the internet. I have written both synchronous and
asynchronous methods to connect, send, and receive data from the
server. Each request/response can take upto 180 seconds. I am trying to
use the asyncronous calls in an ASP.NET C# 2.0 Webcontrol, which
displays the returned data. At the moment I am happily using the
asyncronous functions and events in my ASP.NET Usercontrol, but I am
having to block the main ASP.NET thread until the worker threads
dealing with the server response notifies my control that it has
returned all data. Then I render the control with all the returned
data. Obviously this destroys the advantage of the async functions.
There is an event firing in the dll that notifies me when new data has
arrived whilst waiting for all data to return. What I would really like
is to render the page to the client and then asynchronously update the
control from the server with the data that has arrived, before all data
has arrived. Could anybody point me in the right direction to implement
this?

OJ

The best way to do what you want is to render the basic HTML "framework"
to the web client, so that the user has something to see instead of a
blank page. Then you use XmlHttpRequest in JavaScript to poll the server.

If you don't want to program the XmlHttpRequest yourself, there are
(too) many AJAX frameworks available. The most well know is prototype,
but JavaScript experts usually recommend against it. One I like is Matt
Kruse's AJAX toolbox
http://www.ajaxtoolbox.com/

Note that programming the XmlHttpRequest is not that difficult,
especially for simple requests.

The server typically sends back text, HTML or XML. It's your task then
to use client-side JavaScript and DOM Level 2 methods to replace nodes
content with the text or HTML returned from the server, or to use the
XML content.

Please feel free to ask more if you have more questions (you'll probably
have), this is just a short intro to AJAX.

Greetings,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Sep 22 '06 #3
Hi,

OJ wrote:
Hi Laurent,
I appreciate the time you have taken to reply. I will take a look at
the site you recommended. To be honest, I too was swamped by AJAX/ATLAS
stuff when I was trying to find out about this technique...
I am not a huge fan of libraries in JavaScript. I prefer to write my own
stuff, I find the learning effect better. It's really fun to do AJAX,
and I'll say it again, not very difficult.
Perhaps my next post on this subject will be in the Javascript
group.....
I am there too.
comp.lang.javascript

Greetings,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Sep 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: dougwig | last post by:
I'm trying to handle the scenario where a user's session times out and and their ajax request triggers a redirection by the webserver (302 error?). I'm using Prototype 1.4 and the my works great...
5
by: simon | last post by:
hello, I have a server set up on my local (home) network and can not get an ajax application to run on the box. it works fine on our developement server and also works fine locally. I...
9
by: Trapulo | last post by:
Hello, with ASP.NET 2.0 Ajax every unexpected error is managed client-side with a popup that reports the error to the user. In ASP.NET 3.5 this behavor has been changed: how can I have a similar...
1
by: Mark B | last post by:
This is my first try at using AJAX. I want the calendars to be enabled if the user checks CheckBox1. It works OK for a normal all page refresh but once I introduced the AJAX code it stopped...
7
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post by:
我们现在遇到一个问题,通过wcf创建的webservice,选择windows service作为宿主,采用java作为客户端调用成功,但是无法使用asp.net ajax调用。...
11
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have run into a situation that if a page/tab that uses the Ajax toolkit (using .net version 3.5) is closed before the Ajax enable controls complete loading, then IE locks up. Does it in both IE7...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
4
by: Peter | last post by:
ASP.NET 2.0 I have an AutoCompleteExtender which works fine- I am using name, id pair in the WebService , but what I am trying to do is: once the user selects an item from the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.