Re: Start to be confuse now....any help ??

Tech-Archive recommends: Speed Up your PC by fixing your registry



Thnaks a lot for your reply.
For my case the server is effectively only take care of recoding data to
database when thge client call the method. No queeuong of message at all. At
least for now.

by this way if I am using the return value of the function, it means that my
client is runing syncronously right ?.

As a singleton mode, the server is creating one single instance at the
method call right, then where this instance reside, in the client side or
server side ? I mean does the instance when method is invoke is return to the
client by reference ?


Base on the fact that fro the time beeing my client is on the same pc as my
server, how does thios callback work if I want to test that ? any simple
sample ?

"Mehdi" wrote:

On Wed, 23 May 2007 06:39:05 -0700, calderara wrote:

I have build a server object hosted in a windows service using tcp.
That object is use as server Activated and singleton mode.

A client application is invoking a method to staore dta to SQL database.
It work greats actually but now I am coming to the point that how my client
can be informed of any error occurs during the storage of data, in order that
it send them again ?

I have read from a document that we must avoid events and callback. Document
can be found here :
http://static.thinktecture.com/Resources/ArchitectureBriefings/RemotingBestPractices.pdf

But then if its is the case, does might client have not to worried about any
error that occurs at the server side ?

It depends how your server service works. If the remote method invoked by
the client performs the database work itself, you can use the return value
or throw exceptions to let the client know when something went wrong.

If the remote method simply queues up the command sent by the client to be
processed later or by another thread, then you cannot use the return value
of the function or throw exceptions to let the client know that something
went wrong since its command has not yet been processed when the remote
method returns. In this case, it is perfectly fine to send events from the
server back to the client to let the client know of what's going on.

The reason why the article above advises against using events or callback
is not because it's a bad idea but because the built-in TCP channel is not
bi-directional which means that sending events won't work if the client is
behind a firewall or NAT router which is almost always the case with PCs
connected to the Internet.

When you send an event or invoke a callback from the server to the client
using the built-in TCP channel, .NET Remoting will not re-use the existing
TCP connection to send the event but instead will attempt to open a new TCP
connection back to the client. If the client application is behind a NAT
router or a firewall which blocks incoming connections (as most firewalls
do by default), this will fail and your server application will fail to
send events or invoke callback methods to the client. So if you want to use
events with the built-in TCP channel, you must make sure that the user of
the client appplication has openened the relevant port in his firewall and
has set-up a virtual server on his NAT router if behind a NAT router. In
practice, this is way too much to much trouble and way too difficult to do
for the average user. Hence the advice given in the article.

The solution if you need to send events from the server application is to
either develop a custom bi-directional channel or buy a commercial one such
as the excellent Genuine Channels: <http://www.genuinechannels.com/> (the
site seems to be down at the moment).

.



Relevant Pages

  • Re: Intermittent Remoting Event Callback Problem
    ... MarshalByRefObj created using the New statement and returned to the client ... a SAO resulting in a callback to a "proxy"/wrapper class. ... to the server upon disconnection. ... reqMsg, IMessage retMsg) ...
    (microsoft.public.dotnet.distributed_apps)
  • Re: Custom COM callbacks
    ... a COM server cleanup connections to a client if the client crashes". ... I have an out of process COM server that provides notifications of events to ... clients via a custom callback interface. ... call Release on the callback interfaces, ...
    (microsoft.public.vc.atl)
  • Re: What doesnt lend itself to OO?
    ... >> proxy and instructs the server to constuct the real object. ... rather than client code. ... If 'clock' is instantiated in the server, ... > for the server interface at the OOA level. ...
    (comp.object)
  • This is going straight to the pool room
    ... or not the client has privilege to do what they're trying to do, ... The server environment is this: ... 3GL User action Routines that Tier3 will execute on your behalf during the ... Routine Name: USER_INIT ...
    (comp.os.vms)
  • [Full-Disclosure] R: Full-Disclosure Digest, Vol 3, Issue 42
    ... Full-Disclosure Digest, Vol 3, Issue 42 ... SD Server 4.0.70 Directory Traversal Bug ... Arkeia Network Backup Client Remote Access ...
    (Full-Disclosure)