[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

App gets lost during callback on client

Phil Greg

11/4/2004 3:03:00 PM

Hi,
I'm pretty new to this, so sorry if I'm not being too clear... I implemented
events using the callback method (defined an interface in the common project,
from which my client class is derived, I pass a reference of this to the
server, which in turn calls up a function on my client). It seems to work
fine, as I put a breakpoint in my client side function, and it does get
called up properly. However, after the program exits my client side function,
my client seems to get stuck, and the top lines of the call stack (client
side) looks something like this:
00000000()
system.dll!System.Net.Sockets.Socket.Receive(byte[] buffer = {Length=4096},
int offset = 0, int size = 4096, System.Net.Sockets.SocketFlags socketFlags =
None) + 0x167 bytes
system.runtime.remoting.dll!System.Runtime.Remoting.Channels.SocketStream.Read(byte[]
buffer = {Length=4096}, int offset = 0, int size = 4096) + 0x30 bytes
system.runtime.remoting.dll!System.Runtime.Remoting.Channels.SocketHandler.ReadFromSocket(byte[]
buffer = {Length=4096}, int offset = 0, int count = 4096) + 0x28 bytes
system.runtime.remoting.dll!System.Runtime.Remoting.Channels.SocketHandler.BufferMoreData() + 0x1f bytes
Am I missing something obvious?
4 Answers

Phil Greg

11/4/2004 3:09:00 PM

0

I just took a look at the server side, and the functions returns properly. So
for some reason, after the callback function is called up in my client, the
control isn't returned to the form.
(By the way, my client class derived from my interface is a form. Could that
be the problem, and is that a bad practice?)

Ken Kolda

11/4/2004 4:40:00 PM

0

You may want to post some code. It's easy to run into threading issues when
using a Form as a remoting server. The main things to watch out for are:

1) When you form executes a remoting request, be sure you do not directly
access controls on the form. Use Form.Invoke() or Form.BeginInvoke()
instead.

2) If your form is both a client of your remote object and has a callback,
be doubly careful. If you invoke your remote object in response to a button
click or other UI event and that remote object calls back into your form,
you should use BeginInvoke() to access your form's controls (i.e. don't use
Invoke()).

Hope that helps -
Ken


"Phil Greg" <PhilGreg@discussions.microsoft.com> wrote in message
news:F063AEC4-1F95-4D69-B4BB-A389E38529DE@microsoft.com...
> I just took a look at the server side, and the functions returns properly.
So
> for some reason, after the callback function is called up in my client,
the
> control isn't returned to the form.
> (By the way, my client class derived from my interface is a form. Could
that
> be the problem, and is that a bad practice?)
>


Robert Jordan

11/4/2004 4:45:00 PM

0

Phil Greg wrote:

> I just took a look at the server side, and the functions returns properly. So
> for some reason, after the callback function is called up in my client, the
> control isn't returned to the form.
> (By the way, my client class derived from my interface is a form. Could that
> be the problem, and is that a bad practice?)
>

Are you accessing the UI from the callback? That's bad because
you have to do it synchronously.

http://msdn.microsoft.com/msdnmag/issues/04/05/Basic...

bye
Rob

Phil Greg

11/4/2004 4:59:00 PM

0

Ok thanks a lot, I'll check that out!

"Robert Jordan" wrote:

> Phil Greg wrote:
>
> > I just took a look at the server side, and the functions returns properly. So
> > for some reason, after the callback function is called up in my client, the
> > control isn't returned to the form.
> > (By the way, my client class derived from my interface is a form. Could that
> > be the problem, and is that a bad practice?)
> >
>
> Are you accessing the UI from the callback? That's bad because
> you have to do it synchronously.
>
> http://msdn.microsoft.com/msdnmag/issues/04/05/Basic...
>
> bye
> Rob
>