Oh, someone came across the same questions as me, citing the following:
This is the URL:
http://cache.baidu.com/c?m= 9f65cb4a8c8507ed4fece763104c8c711923d030678197027fa3c215cc79031c1d3aa5ec76780d548d98297a5ae91e03f7fb36253d0070e49fcfdf4fd 9b8c37c798
Development test Environment: virtual machine centos,windows Network debugging assistantNon-blocking mode has 3 uses1. Three-time handshake to do other processing at the same time. Connect takes a round trip time, from a few milliseconds of LAN to a
In recent projects, there is a need to detect whether an IP address is a pass-through, using the socket's connect function. However, when the IP address is incorrectly written, connect will always be blocked there for about 2 or 3 minutes to return
1. PrefaceRecently, a test tool has been written that requires fast and efficient scanning of which ports are open to each server. At that time, Ping can only detect IP, determine the server network is connected, but not to determine whether the
1. Set the flag bit to non-blocking mode, and call the connect function in non-blocking mode.
2. call connect. Normally, the TCP three-way handshake takes some time, but the non-blocking call will return an error if it cannot be completed
Step 1: Set non-blocking, start the connection to implement non-blocking connect, first set the SOCKFD to non-blocking. This calls connect to return immediately, handling three cases based on the return value and errno: (1) If you return0,
We do some more work for the client's writing. This time we use non-blocking IO to implement the Connect function. int Connect (intconststruct sockaddr *addr, socklen_t Addrlen);Non-blocking IO has the following uses:
1. The process of
Connect Timeout:
Currently, the common method for setting SOCKET connect timeout on each platform is to use select (). The specific method is as follows:
1. Establish socket;
2. Set the socket to non-blocking mode;
3. Call connect ();
4. Use select (
1. Set the flag bit to Non-blocking mode, and call the connect function in Non-blocking mode.2. call connect. Normally, the TCP three-way handshake takes some time, but the non-blocking call will return an error if it cannot be completed immediately.
Description: This article applies to the Windows platform, followed by an additional application for Linux platform
Turn from: http://www.cnblogs.com/shiqgfmj/archive/2010/12/29/1919434.html
Non-blocking socket client connect () has been bothering
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.