Hello,
I have created a chat (from a remoting book 'Advanced .NET Remoting in
VB.NET') that runs great in a desktop application. I have taken the code
and converted it over to an aspx web page. When the message is sent to the
server the aspx page waits for the message to return and then places it
inside a listbox.
The problem is that when another visitor sends a message no event is fired
that causes the other visitors to receive the message, or the page is not
listening.
I have done some experiments and have found that if one visitor sends a
message over and over really fast and another visitor sends a single
message, that if the timing is right he will receive the other visitors
message.
What could I be doing wrong. My code example is below.
Dim bcaster As IBroadcaster
Dim WithEvents wrapper As BroadcastEventWrapper
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Session("Done") = Nothing Then
Try
RemotingConfiguration.Configure(Server.MapPath("XM LConfig.xml"))
Catch exc As Exception
End Try
ListBox1.Items.Add("Welcome...")
Session("Done") = "True"
End If
bcaster = CType(RemotingHelper.GetObject(GetType(IBroadcaste r)),
IBroadcaster)
wrapper = New BroadcastEventWrapper(bcaster)
End Sub
Public Sub wrapper_MessageArrivedLocally(ByVal msg As String) _
Handles wrapper.MessageArrivedLocally
ListBox1.Items.Add("Message: " & msg)
End Sub
Private Sub btnSendMessage_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSendMessage.Click
bcaster = CType(RemotingHelper.GetObject(GetType(IBroadcaste r)),
IBroadcaster)
bcaster.BroadcastMessage(TextBox1.Text)
TextBox1.Text = ""
bcaster = CType(RemotingHelper.GetObject(GetType(IBroadcaste r)),
IBroadcaster)
wrapper = New BroadcastEventWrapper(bcaster)
End Sub
Thanks,
Chuck 1 1045
your approach will not work with web forms. for each page request a form
object is created, called to produce the html then released. if the browser
requests another page the cycle starts over.
once the html has been render, whatever your class does to events it
recieves has no impact on the browser (as its already has the html). to do a
web based chat you need to have the webpage poll the server for messages.
most sites do this with a javascritp and a hidden iframe.
-- bruce (sqlwork.com)
"Charles A. Lackman" <Ch*****@CreateItSoftware.net> wrote in message
news:Ov**************@TK2MSFTNGP09.phx.gbl...
| Hello,
|
| I have created a chat (from a remoting book 'Advanced .NET Remoting in
| VB.NET') that runs great in a desktop application. I have taken the code
| and converted it over to an aspx web page. When the message is sent to
the
| server the aspx page waits for the message to return and then places it
| inside a listbox.
|
| The problem is that when another visitor sends a message no event is fired
| that causes the other visitors to receive the message, or the page is not
| listening.
|
| I have done some experiments and have found that if one visitor sends a
| message over and over really fast and another visitor sends a single
| message, that if the timing is right he will receive the other visitors
| message.
|
| What could I be doing wrong. My code example is below.
|
| Dim bcaster As IBroadcaster
| Dim WithEvents wrapper As BroadcastEventWrapper
| Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
| System.EventArgs) Handles MyBase.Load
| If Session("Done") = Nothing Then
| Try
| RemotingConfiguration.Configure(Server.MapPath("XM LConfig.xml"))
| Catch exc As Exception
| End Try
| ListBox1.Items.Add("Welcome...")
| Session("Done") = "True"
| End If
| bcaster = CType(RemotingHelper.GetObject(GetType(IBroadcaste r)),
| IBroadcaster)
| wrapper = New BroadcastEventWrapper(bcaster)
| End Sub
|
|
| Public Sub wrapper_MessageArrivedLocally(ByVal msg As String) _
| Handles wrapper.MessageArrivedLocally
| ListBox1.Items.Add("Message: " & msg)
| End Sub
| Private Sub btnSendMessage_Click(ByVal sender As System.Object, ByVal e As
| System.EventArgs) Handles btnSendMessage.Click
| bcaster = CType(RemotingHelper.GetObject(GetType(IBroadcaste r)),
| IBroadcaster)
| bcaster.BroadcastMessage(TextBox1.Text)
| TextBox1.Text = ""
| bcaster = CType(RemotingHelper.GetObject(GetType(IBroadcaste r)),
| IBroadcaster)
| wrapper = New BroadcastEventWrapper(bcaster)
| End Sub
|
| Thanks,
|
| Chuck
|
|
| This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sean Newton |
last post by:
I am absolutely bewildered by now by the Microsoft.Samples SSPI and Security
assemblies. I've been trying to set these up in a very straightforward
harness in the way that I'd like to be able to...
|
by: bettervssremoting |
last post by:
To view the full article, please visit
http://www.BetterVssRemoting.com
Better VSS Remote Access Tool
This article makes a detailed comparison among SourceAnyWhere,
SourceOffSite, VSS...
|
by: mayamorning123 |
last post by:
A comparison among six VSS remote tools including SourceOffSite ,
SourceAnyWhere, VSS Connect, SourceXT, VSS Remoting, VSS.NET
To view the full article, please visit...
|
by: bettervssremoting |
last post by:
To view the full article, please visit
http://www.BetterVssRemoting.com
Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere
and VSS Remoting
This article makes a detailed...
|
by: Uchiha Jax |
last post by:
Hello everyone,
I am a plenty silly person who is trying to
learn .NET remoting through trial and error (all articles I read are going
over my head at the moment (mostly) so I thought i'd give...
|
by: bettervssremoting |
last post by:
To view the full article, please visit
http://www.BetterVssRemoting.com
Better VSS Remote Access Tool
This article makes a detailed comparison among SourceAnyWhere,
SourceOffSite, VSS...
|
by: Martijn Damen |
last post by:
Hi,
At the moment I am trying to develop an application that uses another app
over .net remoting and having some problems with it (ok, that is ofcourse
why I am here), hope somebody can shine a...
|
by: Raju Joseph |
last post by:
Hi All,
I am just trying to get an opinion here. I know this is always a tough
choice to make.
We are in the process of converting our VB6 based Healthcare Information
System (a full-fledged...
|
by: erbilkonuk |
last post by:
Hi,
I am very new to .NET Remoting and I try to run a simple program to
subscribe to an event raised by Remoting Class. The Remoting Server
initiates an instance of Remoting Class as Singleton /...
|
by: Kristian Reukauff |
last post by:
Hi
I have a problem with the .Net-Securty-Functions.
I've got a client and a server.
When I try to register a channel at the server with this line:
ChannelServices.RegisterChannel(chan, false);...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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 project—planning, coding, testing,...
| |