Realization of Peer-to-peer Communication in C # (1)

Source: Internet
Author: User
Tags thread
Peer-to-peer 1. Mode: Client/server (which is what we usually call C/s mode)
2. Network connection process:

3. Namespaces to use
System.net,system.net.socket,system.system.threading
http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpref/html/ Frlrfsystemwindowsformsprogressbarclasstopic.asp
http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpref/html/ Frlrfsystemwindowsformsprogressbarclasstopic.asp
http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpref/html/ Frlrfsystemwindowsformsprogressbarclasstopic.asp
(Please refer to MSDN for details)
4. Design principle
1. Server side: Accept the connection module, accept the information module
When starting a server-side program, start a thread to listen for the connection signal, if once received the connection signal immediately start receiving the message of the thread, at this time, there are 2 threads running, listening to the connection signal based on the client information to determine whether to start or abort the thread receiving the information.
2. Client: Send the connection request module, send the information module



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.