Use asynchronous Socket programming in C # to implement the C/S communication architecture of TCP network services (I) ---- Basic Library section

Source: Internet
Author: User
Tags socket
//////////////////////////////////////// //////////////////////////////////////// //////////
/*
Title: use asynchronous Socket programming in C # to implement the C/S communication architecture of TCP network services (I) ---- Basic Library section
When I see TcpListener and TcpClient in. NET, I am very happy, that is, the communication mode I want.
However, we can see that their power is too thin. We need a better class library to replace them.
The following provides some classes to complete the Tcp C/S communication mode. In the second part of this article, I will introduce how to use them.
The whole function is implemented through events:
Server events include:
Full server
New client connection
Close client
Received data

Events used by the client include:
Connected server
Received data
Close connection
In addition, the encoder and the packet parser are provided for flexible processing of demand changes.
Note: This class library has not been strictly tested. If a Bug occurs, please send it to me. I will feel that your entire behavior is an encouragement and support to me.
*/
//////////////////////////////////////// //////////////////////////////////////// //////////
/// <Summary>
/// (C) 2003-2005 C2217 Studio
/// Retain all rights
///
/// File name: TcpCSFramework. cs
/// File ID:
/// Programming language: C #
/// File description: Basic class of the C/S communication architecture that provides TCP network services
/// (Using asynchronous Socket programming)
///// Current version: 1.1
/// Replace version 1.0
///
/// Author: Deng Yangjun
// EMail: dyj057@gmail.com
/// Creation date:
/// Last modification date: 2005-3-17
///
/// Historical modification records:
///
/// Time: 2005-3-14
/// Modify the content:
/// 1. Create an Ibms. Net. TcpCSFramework namespace and add a Session object.
/// 2. Modify the NetEventArgs class to adapt to the newly added object.
/// 3. Added the session exit type, which is more suitable for actual scenarios.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.