The procedure of using standard socket function in VCSocket is a very popular in Linux or UNIX network programming way, this way is simple and effective, can be very flexible to complete a variety of complex protocol control, personal feeling than
First, the network program based on TCP protocol
The following figure is a general process for client/server programs based on TCP protocol:
After the server calls the socket (), bind (), listen () completes initialization, calls the accept ()
A few days ago learned Android under Socket programming, as individuals are just beginning to learn the appropriate knowledge of Android. So deliberately to learn the code and process, written as a BLOG, such as:
The PHP socket function is about the same as the C-style socket functionSocket function:http://php.net/manual/en/book.sockets.phpServer-side:Set_time_limit(0);$server _socket= Socket_create (Af_inet, Sock_stream, sol_tcp);Socket_bind ($server
In the client code, the first called function is socket (). Before this function is called, what did the system do to make the socket () call normal?
First of all, the socket function is actually a system call. It is the code in the kernel. Our
Function Name Descriptionsocket_accept () accepts a socket connectionSocket_bind () binds the socket to an IP address and portSocket_clear_error () clears the socket error or the last error codeSocket_close () Close a socket resourceSocket_connect ()
PHP Socket function reference. These Socket functions send messages directly with the Internet Protocol. Compared with the fopensock stream, they operate at a relatively low level. Generally, they all block C functions.
These Socket functions send
Python uses socketserver to implement the concurrent socket function, pythonsocketserver
This article uses the powerful python socketserver module to implement socket concurrency.
The directory structure is as follows:
Put the test file in the
Python uses socketserver to implement the concurrent socket function, pythonsocketserver
This article uses the powerful python socketserver module to implement socket concurrency. The specific content is as follows:
The directory structure is as
Sock function Introduction
Name of function
Describe
Socket_accept ()
Accept a socket connection
Socket_bind ()
Bind the socket to an IP address and port
Socket_clear_error ()
Clears the
This article describes how to use the C language socket function in Linux to establish a TCP connection, which is compatible with C ++.
TCP connections can be used to transmit information of common protocols such as HTTP and FTP, which is an
Let's take a look at the prototype of the socket function:
Socket PASCAL FAR socket (int af, int type, int protocol);
The typical invocation method is:
unsigned int socksrv = socket (af_inet, sock_stream, 0);
The 1.AF is the acronym for Address
Basic operation of Socket:
(1) socket () function:
(2) Bind () function:
(3) Listen (), connect () function;
(4) The Accept () function;
(5) The Send and receive functions in the socket:
(6) The Close () function:
(7) The socket function is called
Basic Winsock knowledge
We do not plan to systematically introduce socket or Winsock knowledge here. First, we will introduce the Winsock API function, introduce the concept of blocking/non-blocking, and then introduce the use of socket.
Winsock
We know the value of information exchange, how the process of communication between the network, such as we open the browser every day to browse the Web page, how the browser process and the Web server communication. When you chat with QQ, QQ
What is socket
A socket interface is an API of a TCP/IP network. A socket interface defines many functions or routines. programmers can use it to develop applications on a TCP/IP network. To learn TCP/IP network programming on the internet, you
We know the value of the exchange of information, how the process of communication between the network, such as when we open the browser every day to browse the Web page, how the browser process to communicate with the Web server? When you chat with
"Everything is socket!. ”Although the words are slightly exaggerated, but the fact is, the current network programming is almost all using the socket.--Thoughts on practical programming and open source project research.Original address:
This article was reproduced from: http://blog.csdn.net/yusiguyuan/article/details/17538499We know the value of the exchange of information, how the process of communication between the network, such as when we open the browser every day to browse
"Everything is socket!. ”Although the words are slightly exaggerated, but the fact is, the current network programming is almost all using the socket.--Thoughts on practical programming and open source project research.We know the value of the
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.