473,387 Members | 3,821 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.

Communicating windows service with windows app: remoting?

Hello. I have a windows service running that listens to a port and makes
insert queries in a database.

I need to make an interface, so my idea is creating a simple windows
application that just shows messages from the service.

Can I do that with remoting? What are the main steps to do that?

--

Regards,

Diego F.

May 8 '07 #1
7 2260
One way i can recommend is while the windows service is processing, let it
write onto event viewer. So that you can use the windows app to read the
messages from Event viewer on a perioding intervels.

HTH
--
Every thing is perfect, as long as you share!!!

Don''t forget to rate the post
"Diego F." wrote:
Hello. I have a windows service running that listens to a port and makes
insert queries in a database.

I need to make an interface, so my idea is creating a simple windows
application that just shows messages from the service.

Can I do that with remoting? What are the main steps to do that?

--

Regards,

Diego F.

May 8 '07 #2
If you already have it listenting to one port, why not just have it listen
to another on a different thread and have your interface communicate with it
through sockets.

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog

"Diego F." <di********@msn.comwrote in message
news:eQ**************@TK2MSFTNGP04.phx.gbl...
Hello. I have a windows service running that listens to a port and makes
insert queries in a database.

I need to make an interface, so my idea is creating a simple windows
application that just shows messages from the service.

Can I do that with remoting? What are the main steps to do that?

--

Regards,

Diego F.

May 8 '07 #3
"Diego F." <di********@msn.comwrote in message
news:eQ**************@TK2MSFTNGP04.phx.gbl...
Hello. I have a windows service running that listens to a port and makes
insert queries in a database.

I need to make an interface, so my idea is creating a simple windows
application that just shows messages from the service.

Can I do that with remoting? What are the main steps to do that?
Sure you can, and you can also use WCF (V3 of the Framework).
When using local cross-process remoting, your best bet is to use the
"IpcServerChannel".
Implement the "server side" in your Windows application and make sure it
runs on a thread separated from the UI thread, keep in mind to marshal the
calls when updating the UI. Your Service simply acts as a remoting client.
Search MSDN, it sure contains some simple samples to give you an head start.

Willy.

May 8 '07 #4

"Chakravarthy" <ds******@india.comwrote in message
news:8A**********************************@microsof t.com...
One way i can recommend is while the windows service is processing, let it
write onto event viewer. So that you can use the windows app to read the
messages from Event viewer on a perioding intervels.
That looks easy. I can try that. Thank you for your idea. The only issue is
that won't be in real time.

--

Regards,

Diego F.

May 8 '07 #5

"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:66**********************************@microsof t.com...
"Diego F." <di********@msn.comwrote in message
news:eQ**************@TK2MSFTNGP04.phx.gbl...
>Hello. I have a windows service running that listens to a port and makes
insert queries in a database.

I need to make an interface, so my idea is creating a simple windows
application that just shows messages from the service.

Can I do that with remoting? What are the main steps to do that?

Sure you can, and you can also use WCF (V3 of the Framework).
When using local cross-process remoting, your best bet is to use the
"IpcServerChannel".
Implement the "server side" in your Windows application and make sure it
runs on a thread separated from the UI thread, keep in mind to marshal the
calls when updating the UI. Your Service simply acts as a remoting client.
Search MSDN, it sure contains some simple samples to give you an head
start.

Willy.
Then, just to identify the scenario, according to the MSDN help I need:

A remotable object.
A host application domain to listen for requests for that object.
A client application domain that makes requests for that object.

You suggest that the client is the service and the host is the windows app.
Which is the remotable object?

--

Regards,

Diego F.


May 8 '07 #6
"Diego F." <di********@msn.comwrote in message
news:uj*************@TK2MSFTNGP02.phx.gbl...
>
"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:66**********************************@microsof t.com...
>"Diego F." <di********@msn.comwrote in message
news:eQ**************@TK2MSFTNGP04.phx.gbl...
>>Hello. I have a windows service running that listens to a port and makes
insert queries in a database.

I need to make an interface, so my idea is creating a simple windows
application that just shows messages from the service.

Can I do that with remoting? What are the main steps to do that?

Sure you can, and you can also use WCF (V3 of the Framework).
When using local cross-process remoting, your best bet is to use the
"IpcServerChannel".
Implement the "server side" in your Windows application and make sure it
runs on a thread separated from the UI thread, keep in mind to marshal
the calls when updating the UI. Your Service simply acts as a remoting
client.
Search MSDN, it sure contains some simple samples to give you an head
start.

Willy.

Then, just to identify the scenario, according to the MSDN help I need:

A remotable object.
A host application domain to listen for requests for that object.
A client application domain that makes requests for that object.

You suggest that the client is the service and the host is the windows
app.
Which is the remotable object?

--

Regards,

Diego F.


The "remotable object", is the object you want to pass from the client to
the server, for instance the service state information (what you called
"messages from the service") you want to pass from your service to the
Windows application. This object must derive from MarshalByRefObject and
implement a common interface.

Willy.


May 8 '07 #7

"Diego F." <di********@msn.comwrote in message
news:eQ**************@TK2MSFTNGP04.phx.gbl...
Hello. I have a windows service running that listens to a port and makes
insert queries in a database.

I need to make an interface, so my idea is creating a simple windows
application that just shows messages from the service.

Can I do that with remoting? What are the main steps to do that?
Why don't you look up how to do a Service OnCustomCommand event, which can
be done from a Windows Desktop application that's communicating with the
service?

The OnCustomCommand event gathers your messages from the service, which
could be held in an array, writes the data to a text file in a directory,
the Windows Desktop application, detects this file's presence and displays
the data in a Listbox.


May 8 '07 #8

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

Similar topics

2
by: Dennis Stew | last post by:
How do I access Public variables within a Windows Service? I can, and have, created installed and executed a basic Service. From my client App I can Start, Stop...etc the service.... What I want...
2
by: Fadi | last post by:
Backround: I am trying to figure out how to do the equivalant of a classic COM Local Server Singleton in .NET/C#. I created a coupld of simple Class Libs that exposes public interfaces and hosted...
0
by: Tappy Tibbons | last post by:
We are trying to write a simple GUI front end to communicate with a service. We need the GUI to make the service fire certain events if the user needs to re-perform certain tasks manually, and...
5
by: Brian Patrick | last post by:
I have an application model which will consist of a front-end configuration application, which needs to control the state of a back-end vb.net windows service (which is the component that does all...
17
by: UJ | last post by:
Is there any way for a windows service to start a windows program ? I have a service that will need to restart a windows app if it needs to. TIA - Jeff.
2
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app...
7
by: deko | last post by:
I'm trying to finalize a windows service design any would appreciate any comments - I'm new to windows services. Essentially my UI app relies on a service to schedule IO tasks. The service does...
0
by: Jason | last post by:
Ok, for the life of me, I just don't understand what's going on. I want to use remoting to send messages from a windows service to a windows form app, but I just can't get it to work. So, here's...
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: 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:
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.