473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Windows Service + TcpChannel Callback

Greeting Nicholas,

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?


May 2 '07 #1
0 1340

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Eric | last post by:
I have a Windows service that I created that simply exposes a single public function (RemoteCall). How can I access this publicly exposed method of a windows service from a windows application?...
1
by: Ahmet AKGUN | last post by:
Hi All; I have one server to which clients are connected to via TcpChannel. I start server on one host and establish a client connection from another host via tcpchannel. On client, using...
0
by: Jasleen | last post by:
I am a progammer in ATL-COM I wanna create an instance of a component running in a remote service i.e make a client of a WinNT service wriitten using ATL using C#.I am very new to C#. I just know...
1
by: Jim Bayers | last post by:
I have three servers Campus Server | Secure Server | Public Server Do to the sensitive nature of the data, my network nazi wants me to access the campus server via the secure server. ...
1
by: Remy De Almeida | last post by:
Hi , Sorry i am posting this again as no one seems have taken notice of this in the distributed appln forum I have a remote server which works fine. The Client ans server work with no problem....
0
by: Douglas Peterson | last post by:
I'm using Remoting to implement a client/server. I recently discovered that I cannot connect a second instance client because it is trying to reuse the port and appearently the socket isn't setup...
2
by: =?Utf-8?B?RGlvZ28gQWx2ZXMgLSBTb2Z0d2FyZSBEZXZlbG9w | last post by:
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...
0
by: abhijit4229 | last post by:
Hello, I have strange situation on hand , I have remotely exposed an object through Windows serice. I am using Client Activated Objects(CAO) . Now whenever I try to create an proxy object...
14
by: Peter | last post by:
..NET 3.5 I have a Windows Service application and it does remoting, but when a client incounters an error the client get the following error message "Server encountered an internal error....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
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...
0
jinu1996
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.