473,614 Members | 2,328 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3988
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 MarshalByRefObj ect. 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
MarshalByRefObj ect, 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.co m

"WinDev" <Wi****@discuss ions.microsoft. com> wrote in message
news:7F******** *************** ***********@mic rosoft.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 MarshalByRefObj ect. 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
MarshalByRefObj ect, 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.co m

"WinDev" <Wi****@discuss ions.microsoft. com> wrote in message
news:7F******** *************** ***********@mic rosoft.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(Dat aSet 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
MarshalByRefObj ect 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.co m

"WinDev" <Wi****@discuss ions.microsoft. com> wrote in message
news:59******** *************** ***********@mic rosoft.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 MarshalByRefObj ect. 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
MarshalByRefObj ect, 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.co m

"WinDev" <Wi****@discuss ions.microsoft. com> wrote in message
news:7F******** *************** ***********@mic rosoft.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
9005
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 still shows on a Task Manager list. In Services it says it is still running. However there is no way to stop it other than by rebooting the whole computer. No exception (including non-CLS) is ever generated. I added a separate System.Timers.Timer...
4
2411
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). The problem is that the user who "owns" the service is always the ASPNET account. That's not good since you don't see the actual application (because it's owned by ASPNET). I've tried changed the processmodel section in the machine.config file to...
3
1458
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, what methods are there in VB.NET to connect the various types of applications together? Is there some sort of messaging system?
7
2394
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 System.Diagnostic.Process object to start the application (i.e Notepad), the new app runs and it is listed on the task manger list, but the GUI doesn't show up in the desktop of the current user. I am aware windows service (either LocalSystem,...
27
4709
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 have so far...its builds fine but when I go to start the service i get the following error. --------------------------- Services ---------------------------
2
1966
by: Elioth | last post by:
Hi, How I Debug a Windows Services in VB 2005? Thanks for all help. Elioth
28
7361
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). I have created a windows service from VStudio 2005 template. What is the windows service replacement for Application.Run()?
9
2328
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 have that run separately from my service?
5
3295
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? Why do I need to set a property within my code to the service name? Are all these required or am I just doing this for consistency purposes?
0
8198
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8142
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8591
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8294
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7115
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5549
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4138
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1438
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.