C # Socket notes

Source: Internet
Author: User
1. Socket synchronization and Asynchronization

This code is reached during synchronization.
Tcpclient. receive ();
Will not be executed downward,
It is a kind of infatuation,

Tcpclient. beginreceive ();
It belongs to the kind of everything. Of course it is good, and it doesn't matter if it doesn't exist,
The one that won't survive ..

Synchronization It is a single thread. You can do the next step only after completing one step. If you are blocked in the first operation, such as network latency, you must wait.

While Asynchronization is multi-thread, enabling Asynchronization Method A new thread is created for processing, and the main thread continues to run. After the Asynchronous Method is completed, the callback function can be started to return the result to the main thread.

To put it simply:
Synchronization is always waiting to return
Asynchronous processing means that other processing is performed first, regardless of whether the response is returned.

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.