473,837 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2283
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******** ******@TK2MSFTN GP04.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******** ******@TK2MSFTN GP04.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
"IpcServerChann el".
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

"Chakravart hy" <ds******@india .comwrote in message
news:8A******** *************** ***********@mic rosoft.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.bewro te in message
news:66******** *************** ***********@mic rosoft.com...
"Diego F." <di********@msn .comwrote in message
news:eQ******** ******@TK2MSFTN GP04.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
"IpcServerChann el".
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******** *****@TK2MSFTNG P02.phx.gbl...
>
"Willy Denoyette [MVP]" <wi************ *@telenet.bewro te in message
news:66******** *************** ***********@mic rosoft.com...
>"Diego F." <di********@msn .comwrote in message
news:eQ******* *******@TK2MSFT NGP04.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
"IpcServerChan nel".
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 MarshalByRefObj ect and
implement a common interface.

Willy.


May 8 '07 #7

"Diego F." <di********@msn .comwrote in message
news:eQ******** ******@TK2MSFTN GP04.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
2302
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 to do is to read properties that are in the service. for instance if the service had a Propertie or Public variable like Public Int Myint = 12; (or... Public Myint as integer = 12)
2
7283
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 them in a Windows Forms EXE. Create a Windows Forms client and both the Client and the Host EXEs configure the remoting protocols through respective .config files. Problem: I want to change the host from an Win Forms EXE to a Windows Service.
0
936
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 possibly return a result string with back to the user from what the service did, records processed, errors, etc. We are thinking there should be a system tray icon as well that the user uses to open the GUI as needed. We tried to keep it...
5
8480
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 the work). Think of this in the same manner as say microsoft management console and the w3svc (inetinfo) service. What should the standard communication protocol be between the configuration app and the service in this model? For example,...
17
6460
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
6904
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 (which is the UI used to adjust the actions taken by, and the schedule of the service), then a privileged user thread should be used in the UI - no service required. But... "A windows service enables the creation of long-running executable
7
3092
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 nothing but keep track of elapsed time. The reason I need a service is because the IO tasks are login agnostic. It doesn't matter if anyone, or no one, is logged in. The IO tasks are defined in the UI.
0
1135
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 what I have so far. I created a small, remotable object that inherits from MarshalByRefObject. It has a public subroutine that raises an event with a message attached: Public Delegate Sub TestServiceEventHandler(ByVal Message As String) ...
14
5632
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. For more information, turn off customErrors in the server's .config file." Where do I turn this off
0
9683
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
10883
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10578
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
10631
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
10276
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9409
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...
1
7813
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5670
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4477
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.