0

I have a Complex Service that i am working with, and as with all windows services, there is no Console to read any debug messages, or anything like that, so you would have to log all messages to a text file... i'm wanting to write in a small TCP Server (or UDP or NamedPipe doesn't really matter), where i can have a debug application...so basically, the service runs all the time and has this listener / server (Tcp or otherwise) and is always writing Debug messages to the server, if i need to debug the server, i should be able to connect to it using a TCP Client (or whatever protocol) and read any debug messages, or anything where i would typically use Console.WriteLine("Message");

i know this seems like a crazy idea, but it's something I've been considering and needed some input on...

my basic problem is that i can write a TCP Server into the Service, but i am unsure how to pass the messages to it all the time, or only when a client is connected, any advice or examples would be greatly appreciated.

Note: I am using C# and would like to stick to that language.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Brad
  • 121
  • 1
  • 7

1 Answers1

0

In the past, I've used a TcpListener for a similar monitoring program. It's an incredibly easy thing to create. And to communicate with it, I created a TcpClient in the service.

A good example of how to make those two work together is in this answer.

Community
  • 1
  • 1
Jim Mischel
  • 131,090
  • 20
  • 188
  • 351