2

I want to create a simple application in C# that sits between an existing TCP client and server, both legacy systems. Most of the time the application will simply pass messages from the client to the server and back again without modification. In one, maybe two cases, when it sees certain data from the client, it will modify this data slightly before passing it onto the server. It will not change the length of the data. It will not change the response from the server. How do I implement this in C#?

After much Googling, I found some suggestions, (some being an understatement!). There seems to be a multitude of way to implement a socket server in C# and no single, standard way, For example:

All in all quite a bewildering amount of information! It all seems overly complicated and total overkill for my use. I first thought of doing this in WCF, where all the underlying complexity is handled for me but apparently it's not possible (or very difficult) to do in WCF. Is there some way to implement what I want without going into all this complexity? Any 3rd party library or component that would simplify this implementation? Alternatively, maybe there is a hardware device that would allow me to this? Over to you.

Community
  • 1
  • 1
VinceJS
  • 1,254
  • 3
  • 18
  • 38
  • My first thought was to use netcat or similar tool to connect to the web services, then pass the data from there to the app via stdin/stdout. That way, your app becomes a simple filter, and you don't need to implement all the network stuff yourself… – dumetrulo Mar 15 '17 at 11:09
  • I don't think its going to get simple than those async MSDN examples, even with a 3rd party component. – Alex K. Mar 15 '17 at 11:19
  • Found this cross platform version of netcat: https://nmap.org/ncat/, seems like the easiest way to go. Not sure exactly how to implement this, I would create a console app to do the filtering via stdin/stdout and netcat would take care of the comms, Dumetrulo, care to elaborate? – VinceJS Mar 15 '17 at 12:01
  • You might be able to write a filter for some existing product to do this. For example a proxy server that supports plugin filters. There are a number of these including our own product. There's a lot more to getting a service up and running for this kind of task reliably etc than just dealing with the sockets and comms, and you surely wont want to write all that as well. – Adrien Mar 16 '17 at 00:32

0 Answers0