简体   繁体   中英

Simple and quick to implement socket server in C#

I have a C# command line app (the server), that is executed by another app (the client). It simply does a command and shuts down. I'm trying to convert this "run and shut" method to a "constantly running" windows forms. I'll use sockets as a way for the client app to talk to the server in C#. My client app can talk in sockets, but I need a quick and simple way to integrate socket server functionality in C#.

I've tried to work with the following, but they all seem overly complex to integrate. Do you have any idea how to use these effectively, or any simple socket server component in C#?

These seem quite robust, but complex:

These seem quite promising (no idea how limited/functional they are):

They may seem complex but the ASync Socket stuff isn't too bad and there are lots of examples on how to implement it. Being Asynchronous makes it easy to handle multiple connections simultaneously so I'd recommend having another look at it.

I've not used it myself but the TCPListener Class looks simpler to implement and comes with some examples on it's use.

如果您正在寻找可以轻松地使服务器和客户端相互通信的内容 ,请访问networkComms.net ,尤其是在此处演示最基本功能的简短示例,希望它不会过于复杂!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM