I posted these on another group, but was redirected here, so here are my two
posts and my questions:
Post #1:
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\Co nfig.CFG). After it receives something (anything), then
it is supposed to open a file C:\MyService\Fi le.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?
Post #2:
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
"Walkthroug h: 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?
Thanks,
Nikola
--
"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/