I had my Crestron system talking to Media Center just fine. I had written an MD5 implementation required by the Girder iserver component, and although the solution was a bit of a hack, it worked. And well.
But noooo. I have to make it work right. So I set about writing my own app that listens on a TCP socket and controls the ehshell.exe app (MCE Controller). “It will be a great excuse to do some more C# programming and I’ll learn to code to sockets and all about PlatformInvoke interop from the .NET Framework.”
So I begin. But do I make it easy? No. Here are the reqirements:
- Single client sending simple string commands to a listening TCP/IP port.
- Static set of commands, each mapped to either a Windows SendMessage, SendInput, or CreateProcess call.
- For the solution to be useful, user has to be logged on to the interactive console on the MCE PC.
If these are the requiements, why did I spend 2 days trying to implement this as an NT Service? Sure I now understand the .NET classes for Services, the winsta/desktop security model, and that you can’t really get it to work on XP and above, but what did I actually accompish regarding the requirements?
Also, why did I choose to implement my server using the lowest level Socket classes, using the full asynchronous programming model when spinning off a thread and using TCPListener would have taken a fraction of the code and time? Remember I only have a single client to this thing, it doens’t need to scale, blah blah blah. But nooo I had to do it the hard way. I guess I should be happy that I’m now an expert on .NET socket programming.
Or, maybe that’s the point. I don’t have all this hardware and software crap lying around because I actualy use or need it, but because I love learning and all this stuff gives me opportunities.
This raises a question. How unique am I in this regard? Is this just my personal manifestation of the geek/hacker ethic?