Pass arguments to running application

前端 未结 5 1018
猫巷女王i
猫巷女王i 2020-12-01 08:20

I am making an image uploader (upload image to image hosting website) and I\'m having some issues passing an argument (image location to an already running application)

5条回答
  •  Happy的楠姐
    2020-12-01 08:55

    Assuming that you have control over the execution environment, the listening application could just expose an endpoint using WCF or even a raw TCP socket. That way, any other application can connect to it in a dynamic but structured fashion.

    Even though both the sender and receiver are on the same machine, using a network transport solution (like WCF or TCP) is a great way to safely send data across processes.

    Here's an example of how to do it in TCP with c#: http://www.switchonthecode.com/tutorials/csharp-tutorial-simple-threaded-tcp-server

    WCF can be a bit more complicated (due in part to it's flexibility, and also due to serialization restrictions) but there is plenty of documentation online on how to use it. WCFis a more object-oriented solution because proxy classes can be generated that allow you to make strongly-typed calls to actual objects, versus just sending messages.

提交回复
热议问题