Services, C#
- From: "Sourcerer" <enlork@xxxxxxxxxxxxxx>
- Date: Wed, 24 Jan 2007 11:28:23 +0100
This isn't a reply, I've only added one more question at the end.
"Sourcerer" <enlork@xxxxxxxxxxxxxx> wrote in message news:ep5obi$319$1@xxxxxxxxxxxxxxxxx
I've started my first practice windows service project in C#, and I'm already stuck.
Let's say I'm trying to make a simple service (and useless, but good for practice). It is supposed to listen on port which is stored in its configuration file (say C:\MyService\Config.CFG). After it receives something (anything), then it is supposed to open a file C:\MyService\File.TXT, read the number that is written in it, increase it by 1, save it, send it to the application that originally sent the query, close the file and wait for further queries.
In the above, there are three key moments which prevent me from programming such a service:
1. How do I make the service listen on any port?
2. What is the event that is raised (or what do I need to do), when some query actually arrives at that port?
3. How do I make the service send the response to an application which made the query?
If necessary and if you can, disregard the existing standard communication protocols, as I will be programming the client side too, so I suppose it doesn't matter what's the format of my response.
The client, however, is another problem:
How do I make another program (I am programming it) send the query to the port on which my service is listening, and how does it read the response?
While the above still isn't clear, I was using the documentation to create a service, and put it on my services list. I've followed the tutorial "Walkthrough: Creating a Windows Service Application in the Component Designer" to the letter. I've installed the service and it appeared on my available services list.
However, it failed to start. Event log only contained the following message:
Service cannot be started. The service process could not connect to the service controller
What am I doing wrong?
--
"It is easy in the world to live after the world's opinion; it easy in solitude to live after our own; but the great man is he who in the midst of the crowd keeps with perfect sweetness the independence of solitude."
Ralph Waldo Emerson, Self-reliance 1841
http://pinpoint.wordpress.com/
.
- References:
- Services, C#
- From: Sourcerer
- Services, C#
- Prev by Date: Re: Application has requested runtime to terminate it in an unusual way
- Next by Date: How to serialize to binary data for TCP/IP communication
- Previous by thread: Services, C#
- Next by thread: Re: Services, C#
- Index(es):
Relevant Pages
|