473,380 Members | 1,225 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,380 software developers and data experts.

Windows service talking to a Windows Application

We are trying to build a system where we have a Windows Service do some
manipulation of data, and then sending the data to a Windows App. I had
posted a question of how we should do this and was told remoting was the way
to go.

So I got a client and a server program up and going and from the client I
can call a routine in the server program. I can't figure out how to actually
send data to the client. At the moment the client calls a routine that
returns the time from the server (it's a stupid program but it proves it
works.) But what I want to do is send a dataset to the server and then have
the server do some processing on the dataset. I can figure out how to send
the dataset but what do I do at that point? I need to tell the server that it
has new data to process.

Anybody have any ideas on how to get this to work?

Thanks for your help.

Jeff.
Jan 6 '06 #1
4 3970
Jeff,

Well, what does your service do now then? I mean, it's running, and
that's great, but it has to do something. When your object that is being
remoted is hosted in your service gets a call through a method, that is your
opportunity to perform work. You are able to send back data in the form of
output parameters and return values.

Now, are you saying that you want to just call methods on the client
from the service? If that is the case, then you need an object on the
client which derives from MarshalByRefObject. You also need an interface
that is shared between the client and the service which exposes the methods
the service can call on the client.

When the client first connects to the service, you can pass the
implementation of this interface to the service, and the service can store a
reference to it. Because the object passed to the service derives from
MarshalByRefObject, the service will hold a proxy to the client, instead of
a serialized instance.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"WinDev" <Wi****@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
We are trying to build a system where we have a Windows Service do some
manipulation of data, and then sending the data to a Windows App. I had
posted a question of how we should do this and was told remoting was the
way
to go.

So I got a client and a server program up and going and from the client I
can call a routine in the server program. I can't figure out how to
actually
send data to the client. At the moment the client calls a routine that
returns the time from the server (it's a stupid program but it proves it
works.) But what I want to do is send a dataset to the server and then
have
the server do some processing on the dataset. I can figure out how to send
the dataset but what do I do at that point? I need to tell the server that
it
has new data to process.

Anybody have any ideas on how to get this to work?

Thanks for your help.

Jeff.

Jan 6 '06 #2
Nicholas,
Let me try again explaining what I want to do.

I have a service that is running that every once in a while goes out to a
database and does some calculations. I then have a Windows App that displays
the calculations. So I have my Windows service as a client of the windows
app. The service can call a method in the app (and that works fine) but I
can't figure out how to tell the win app that there's new data.

So here's a full outline of what I would like it to do:

Win App is up and going and dispays whatever.
Win Service starts up.
At some point the Win Service creates some new calculations.
Win Service wants to send some kind of notification (and results of the
calculations if possible) to the win app program.
Win App displays the new statistics.

I've got the win app program working. I've got the win service working. I
have the win service making a call to a routine in the win app program. But I
can't figure out what to do in the client so that it knows about the new
data. I can pass the new data in to a routine in the called routine but then
what do I do with it? How does the win app program know about the new data?

Thanks.

Jeff.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Jeff,

Well, what does your service do now then? I mean, it's running, and
that's great, but it has to do something. When your object that is being
remoted is hosted in your service gets a call through a method, that is your
opportunity to perform work. You are able to send back data in the form of
output parameters and return values.

Now, are you saying that you want to just call methods on the client
from the service? If that is the case, then you need an object on the
client which derives from MarshalByRefObject. You also need an interface
that is shared between the client and the service which exposes the methods
the service can call on the client.

When the client first connects to the service, you can pass the
implementation of this interface to the service, and the service can store a
reference to it. Because the object passed to the service derives from
MarshalByRefObject, the service will hold a proxy to the client, instead of
a serialized instance.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"WinDev" <Wi****@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
We are trying to build a system where we have a Windows Service do some
manipulation of data, and then sending the data to a Windows App. I had
posted a question of how we should do this and was told remoting was the
way
to go.

So I got a client and a server program up and going and from the client I
can call a routine in the server program. I can't figure out how to
actually
send data to the client. At the moment the client calls a routine that
returns the time from the server (it's a stupid program but it proves it
works.) But what I want to do is send a dataset to the server and then
have
the server do some processing on the dataset. I can figure out how to send
the dataset but what do I do at that point? I need to tell the server that
it
has new data to process.

Anybody have any ideas on how to get this to work?

Thanks for your help.

Jeff.


Jan 6 '06 #3
WinDev,

That's why I recommended what I did with the interface. Going into more
detail, you would create an interface that exists outside of the client and
server assemblies, like this:

public interface ICallback
{
void DataUpdated(DataSet ds);
}

I'm using a data set here, but you can use anything.

Then, in the client, you would create a class that derives from
MarshalByRefObject which implements this interface.

On the server, you would expos a method which take a parameter of this
interface type.

Then, when your client starts up, you will call the method in the server
which takes an instance of the ICallback interface (or whatever you name it)
and then pass the instance of your object on the client side. The server
will get a proxy to the client, which it can then call into to notify it of
the "update".

Of course, the client on the object can also expose methods and whatnot,
or have a reference to the UI, whatever you need to perform your update of
the data.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"WinDev" <Wi****@discussions.microsoft.com> wrote in message
news:59**********************************@microsof t.com...
Nicholas,
Let me try again explaining what I want to do.

I have a service that is running that every once in a while goes out to a
database and does some calculations. I then have a Windows App that
displays
the calculations. So I have my Windows service as a client of the windows
app. The service can call a method in the app (and that works fine) but I
can't figure out how to tell the win app that there's new data.

So here's a full outline of what I would like it to do:

Win App is up and going and dispays whatever.
Win Service starts up.
At some point the Win Service creates some new calculations.
Win Service wants to send some kind of notification (and results of the
calculations if possible) to the win app program.
Win App displays the new statistics.

I've got the win app program working. I've got the win service working. I
have the win service making a call to a routine in the win app program.
But I
can't figure out what to do in the client so that it knows about the new
data. I can pass the new data in to a routine in the called routine but
then
what do I do with it? How does the win app program know about the new
data?

Thanks.

Jeff.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Jeff,

Well, what does your service do now then? I mean, it's running, and
that's great, but it has to do something. When your object that is being
remoted is hosted in your service gets a call through a method, that is
your
opportunity to perform work. You are able to send back data in the form
of
output parameters and return values.

Now, are you saying that you want to just call methods on the client
from the service? If that is the case, then you need an object on the
client which derives from MarshalByRefObject. You also need an interface
that is shared between the client and the service which exposes the
methods
the service can call on the client.

When the client first connects to the service, you can pass the
implementation of this interface to the service, and the service can
store a
reference to it. Because the object passed to the service derives from
MarshalByRefObject, the service will hold a proxy to the client, instead
of
a serialized instance.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"WinDev" <Wi****@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
> We are trying to build a system where we have a Windows Service do some
> manipulation of data, and then sending the data to a Windows App. I had
> posted a question of how we should do this and was told remoting was
> the
> way
> to go.
>
> So I got a client and a server program up and going and from the client
> I
> can call a routine in the server program. I can't figure out how to
> actually
> send data to the client. At the moment the client calls a routine that
> returns the time from the server (it's a stupid program but it proves
> it
> works.) But what I want to do is send a dataset to the server and then
> have
> the server do some processing on the dataset. I can figure out how to
> send
> the dataset but what do I do at that point? I need to tell the server
> that
> it
> has new data to process.
>
> Anybody have any ideas on how to get this to work?
>
> Thanks for your help.
>
> Jeff.


Jan 6 '06 #4
I am assuming, from your description, that your workflow is something like:

1) Client gets some data from a source other than the server
2) Client hands the data to the server, and the server takes a lot of
time to manipulate it, but the client doesnt want to block on this
operation.
3) On completion of the manipulation, the server hands the data back to
the client.
If that is true, an easy way to do this would be to have the server hand
back a key to the client in step 2, and then have the client poll for
completion of the work in a background thread. Depending on what you
needed to do, you might also consider just doing the post in 2
asynchronously.
WinDev wrote:
We are trying to build a system where we have a Windows Service do some
manipulation of data, and then sending the data to a Windows App. I had
posted a question of how we should do this and was told remoting was the way
to go.

So I got a client and a server program up and going and from the client I
can call a routine in the server program. I can't figure out how to actually
send data to the client. At the moment the client calls a routine that
returns the time from the server (it's a stupid program but it proves it
works.) But what I want to do is send a dataset to the server and then have
the server do some processing on the dataset. I can figure out how to send
the dataset but what do I do at that point? I need to tell the server that it
has new data to process.

Anybody have any ideas on how to get this to work?

Thanks for your help.

Jeff.

Jan 6 '06 #5

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

Similar topics

4
by: Kris | last post by:
I have a Windows Service in C# talking to a serial port and using Remoting. It also uses several COM objects. On customer's computer the service will occassionally hang somewhere - the service...
4
by: Kristof Despiere | last post by:
Suppose you have one domain, filled with a couple of users. What needs to be done now is I need to start a windows application from a webform by pressing a button on the webform (for example). ...
3
by: Lucas Tam | last post by:
Hi all, Assuming I've built a windows form application... how do I connect it to a web service? All the examples of web services I've seen pertain to stand alone applications. Basically,...
7
by: Ahmed Perlom | last post by:
Hi all, I am trying to start a windows application that has a GUI from a Windows service written in .NET 2.0. I have been searching on this for few days now with no avail. When using the...
27
by: pisquem | last post by:
I am building an windows service that is to be deployed on a windows server 2003 and I want to have activity written to the event log, I want its own log called ('CustomLog') Below is what I...
2
by: Elioth | last post by:
Hi, How I Debug a Windows Services in VB 2005? Thanks for all help. Elioth
28
by: | last post by:
I have a multi threaded windows form application that runs great after calling Application.Run(). Application.Run is required for a COM component I a using in the app (required for message loop). ...
9
by: dm3281 | last post by:
Hello -- I plan on writing a C# service using VS2005. If I want my service to have a tray icon, is this typically done from within my service or do/should I create a controller application and...
5
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name?...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.