Coder Social home page Coder Social logo

socketasynceventargsdemo's Introduction

C# 使用.NET的SocketAsyncEventArgs实现高效能多并发TCPSocket通信

官方实例中需要用到几个类:

    1. BufferManager类, 管理传输流的大小 原封不动地拷贝过来,
    1. SocketEventPool类: 管理SocketAsyncEventArgs的一个应用池. 有效地重复使用.
    1. AsyncUserToken类: 这个可以根据自己的实际情况来定义.主要作用就是存储客户端的信息.
    1. SocketManager类: 核心,实现Socket监听,收发信息等操作.

额外功能?

  • 线程守卫精灵 1.自动检测无效连接并断开 2.自动释放资源

使用方法

    int parallelNum = 100;
    int port = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["Port"]);
               
    SocketAsyncServe server = new SocketAsyncServe(port, parallelNum);
    server.Start();

##有问题反馈 在使用中有任何问题,欢迎反馈给我,可以用以下联系方式跟我交流

socketasynceventargsdemo's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.