Thanks for your answer but I'm pretty new in this stuff....
I already have a class that inherits the MArshalByRefObject
and I use it to get answers from the server like this:
On the client windows form I have:
public ServerComm.Server obj = new ServerComm.Server();
public TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);
obj =
(ServerComm.Server)Activator.GetObject(typeof(Serv erComm.Server),
"tcp://n5dalves:50050/RemoteServer");
then I call
obj.GetServerMAchineName();
in the inherited class I have this:
public string GetMachineName()
{
return System.Environment.MachineName ;
}
The problem is that I only get a return at the time...
if the server is processing I would like it to return the progress to the
client...
may you write an example
I'm pretty confused with this :S
"Nicholas Paldino [.NET/C# MVP]" wrote:
Diogo,
The best way to do this would be to create an interface in a separate
assembly that defines the callback into the client. Something like:
public interface IProgressNotification
{
void ProgressChanged(string identifier, int numberProcessed, int total);
}
Or something to that effect, which will notify you of the current
progress (and any other information you need).
You would also have a class which implements this interface in the same
assembly, which implements this interface. The class MUST derive from
MarshalByRefObject. It also exposes events which have the same signature as
the interface (or maybe not, but the events should be able to be mapped from
the interface methods to the events being fired). When the interface
methods are called, you fire the appropriate events.
You would reference this in the server and the client.
On the service, you would take an extra parameter of the interface type.
On the client, you would pass an instance of this class to the initial call.
Before you pass the class, you would sign up for the events on the class.
Then, on the server, call the methods on the interface. Because the
interface implementation derives from MarshalByRefObject, the call will be
made back into the app domain of the client, and then the event will fire,
and you can take the appropriate action.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Diogo Alves - Software Developer" <Diogo Al***@discussions.microsoft.com>
wrote in message news:D8**********************************@microsof t.com...greetings,
I've created a service that is being used as a server, basically i have 1
DLL, one service and one client.
I'm using TcpChannel to talk to the server, so I call the functions
directly
from the client to the server.
Now I have a long process that the server will deal when the client
request... is there a way to keep the client informed about the progress?
I wanted to implement a progress bar with percentage, but all the values I
can get is the return of a function on the server....
How can I workaround this problem?