Recently, a generic tcpclient test gadget was developed using Python for network programming. In the network programming using socket, how to determine whether to send a message to the end is completed, is a socket network development must consider a problem. Here, a brief introduction to the discriminant data received the completion of three commonly used methods: 1. Basic data Reception method: When using the underlying data receive method, an empty string is received when disconnected from the service socket. Therefore, according to this feature, you can add loops to the program and receive data until the data sender closes the socket connection. Applicable scenario: The link between the client and the server is a short link (that is, the connection is closed after a socket communication). The code is as follows: Import Socket,struct,sys,timeport=22220#assume a socket disconnect (data returned is
1. Detailed Python network programming call recv function three ways to receive data completely
Introduction: This article is mainly for everyone to explain the Python network programming call recv function complete receive data three ways, interested small partners can refer to
2. Introduction to the Epoll of Python network programming learning IO multiplexing
Introduction: What is Epollepoll? In the Linux network programming, the long time uses the Select to do the event to trigger. In the new Linux kernel, there is a mechanism to replace it, that is, EP
3. A detailed explanation of Python threads, processes, and co-routines
Introduction: Introduction Interpreter Environment: python3.5.1 We all know that Python network programming two major modules sockets and Socketserver, wherein the socketserver is a support IO multiplexing and multithreading, multi-process module. In general, we will write this in the Socketserver service-side code: Server = Socketserver. Threadingtcpserver (settings. Ip_port, MyServer) threadingtcpser.
4. Tutorial on how to operate a byte stream/binary stream in a struct module in Python
Introduction: Recently in the study of Python network programming this piece, in writing a simple socket communication code, encountered the use of the struct module, was not very clear at that time this has and effect, and later consulted the relevant information about, This article mainly introduces the operation of the struct module in Python, which can be used for reference by friends.
5. A preliminary study of Python socket programming
Introduction: For Python network programming, it is unavoidable to use the socket module. Share some of your personal understanding of the python socket below.
6. Python Network programming
Introduction: Python Network programming
7. Summary of functions commonly used in Python network programming
Summary: Summarize the functions commonly used in Python network programming
8. Python network programming--io multiplexing Epoll
Introduction: Python network programming--io multiplexing Epoll
9. Summary of usage of URLLIB2 module in Python network programming
Introduction: Using the URLLIB2 module for URL-based HTTP requests and so on you may be more familiar with, here we go into the URLLIB2 for HTTP exception handling related functions, take a look at Python network programming urllib2 Module Usage Summary:
Examples of TCP communication instances and Socketserver frameworks used in Python network programming
Introduction: This article mainly introduces the Python network programming TCP Communication Example and Socketserver framework use example, the need for friends can refer to the following
"Related question and answer recommendation":
Python network programming What about learning that knowledge?
Multithreading-What are the alternatives to the Select module in Python network programming?