Remoting and event delegation
Posted on 2003-03-02
I have a simple client/server application set up which uses an event wrapper to notify the client when something happens on the server.
Basically, a remote event wrapper object is set up, it is added to the relevant server method, then the client adds one of its events on to it as well - when the server method calls, it calls the event wrapper, which calls the client event.
It is my understanding that this kind of setup allows the client to register any of its methods with the wrapper, not just static methods (but I'm not sure about this).
I'm passing strings along with the event, and all the events seem to fire along the chain fine. I can show textboxes or add a message to the client ArrayList for messages.
But when I'm over a TCPConnection, I can't SET any of the client controls to reflect changes brought about by the event. The whole client app just hangs. This is where it is weird - if I use an HTTPConnection, everything works fine.
I'm only passing strings around, and I can't figure out why using a TCP connection should make a difference, as the string appears ok at the other end in the debugger.
Any ideas on what would cause the problem when using a TCPConnection? Is it more likely a formatting issue or something about its speed that causes a race?
I can post code for this, but it's already got a lot too it, so let me know which piece in particular you'd like to see and I'll put it up.