time_out)
Wait for the event to occur. Events: Events stored after the epoll_wait operation is completed. Maxevents indicates
Number of socket handles. Time_out is the timeout time. The return value indicates the number of events to be processed, and 0 indicates timeout.
Iv. epoll implementation principles
Epoll_create
A file node is created in the epoll file system, and the epoll kernel high-speed cache zone is opened up to create a red/black tree and allocate
Create a list for memory objects
previous article "five steps teach you how to use nginx + uwsgi + Django to deploy the Django Program (on)", we started uwsgi directly using the command line. In the actual deployment environment, we often use configuration files instead of command lines. My general practice is to use the command line to test whether uwsgi is successfully installed, and then use the configuration file for real deployment.
In addition, soket is used for communication
intIp_tos service typeIp_ttl time int
The following IPv4 Option is used for MulticastIPv4 Option data type descriptionIp_add_membership struct ip_mreq add to multicast groupIp_rop_membership struct ip_mreq exit from multicast groupIp_multicast_if struct ip_mreq specifies the interface for submitting multicast packetsIp_multicast_ttl u_char specifies the TTL of the subscriber.Ip_multicast_loop u_char makes the multicast loop valid or invalidThe ip_mreq structure is defined in the header file:Cod
1.Closesocket (usually does not close immediately and goes through the time_wait process) and wants to continue to reuse the socket:Bool breuseaddr = true;Setsockopt(S, sol_socket, so_reuseaddr, (const char *) breuseaddr, sizeof (bool ));
2.If you want to force close a soket that is already in the connection status after you call closesocketTime_wait process:Bool bdontlinger = false;Setsockopt(S, sol_socket, so_dontlinger, (const char *) bdontlinger
1. if you want to reuse a socket that is already in the established State (usually distinguished by the port number and the flag) after calling closesocket (usually the socket will not be closed immediately but will go through the time_wait process: bool breuseaddr = true; setsockopt (S, sol_socket, so_reuseaddr, (const char *) breuseaddr, sizeof (bool ));
2. if you want to disable soket that is already in the connection state after calling closesock
Foxmail,After each HTTP "Q A" process ends, the server closes the connection.That is to say, You soket creates a socket to connect to the server and sends a request (question ),After the server returns the result (A) of a request, the server closes the socket.What if I want to send the second request? -- Create a socket and connect to the server.
3. Http does not record the visitor's statusAs 2 said, the HTTP protocol does not maintain the connectio
interface standard, it must be implemented. Microsoft's implementation of Owin is a project named Katana (https://github.com/aspnet/AspNetKatana), most of the components in this project are Microsoft. as the prefix, The Owin is the component directory on github:
Katana consists of four parts: Host, server, middleware, and application. For example, the entire structure is hierarchical, from bottom to top:
● Host. The first two are relatively good examples. owinhost.exe is actually a progra
packetsIP_MULTICAST_TTL u_char specifies the TTL of the subscriber.IP_MULTICAST_LOOP u_char makes the multicast loop valid or invalidThe ip_mreq structure is defined in the header file:[Code: 1: 63724de67f]Struct ip_mreq {Struct in_addr imr_multiaddr;/* IP multicast address of group */Struct in_addr imr_interface;/* local IP address of interface */};[/Code: 1: 63724de67f]To add a process to a multicast group, use the setsockopt () function of soket t
1. closesocket (usually does not close immediately and goes through the time_wait process) to continue to reuse the socket:
Bool breuseaddr = true;
Setsockopt (S, sol_socket, so_reuseaddr, (const char *) breuseaddr, sizeof (bool ));
2. If you want to force close a soket that is already in the connection status after you call closesocketTime_wait process:Bool bdontlinger = false;Setsockopt (S, sol_socket, so_dontlinger, (const char *) bdontlinger, s
. write type dataOutputStream. writeByte (f_len); // 3. the length of the message to be written to dataOutputStream. write (data); // 4. write message data dataOutputStream. flush ();
Currently, it is a test. Every time a message is sent, a thread is started and the message is not sent frequently, so it will not be affected.
BluetoothClientThread bluetoothClientThread = new BluetoothClientThread(clientHandler,mContext,msg,socket); new Thread(bluetoothClientThread).start();
2) Receiving text mes
the data and services that the Framework supports for management:
Group data type (array, set, etc)
Package
String Management
Date and Time Management
Raw data block management
Preference Management
URL and data stream operations
Thread and RunLoop
Port and soket Communication
The Core Foundation framework is closely related to the Foundation framework. They provide interfaces for the same functions, but the Foundation framework provides Objective-C
IOS development: _ bridge _ bridge_transfer and _ bridge_retained, iosbridge
Core Foundation framework
The Core Foundation framework is a set of C language interfaces that provide basic data management and service functions for iOS applications. The following lists the data and services that the Framework supports for management:
Group data type (array, set, etc)PackageString ManagementDate and Time ManagementRaw data block managementPreference ManagementURL and data stream operationsThread an
13 of the BIO series of openssl --- Socket Type BIO, openssl13 --- socket
Socket Type BIO
--- Based on openssl doc \ crypto \ bio_s_socket.pod translation and your own understanding, write
(Author: DragonKing [email protected] released in: httpgdwzh.126.com openssl proprietary)
Industry Forum)
The Socket Type BIO is also a source/sink Type BIO, which encapsulates the Socket IO operations.
Some functions are defined as follows (openssl \ bio. h ):
BIO_METHOD * BIO_s_socket (void );
# Define BIO_s
can determine that BIO type is performing IO operations
Do not call the BIO_should_retry function when no retry occurs. This is true for file type BIO.
A typical example.
The BIO of the SSL type is the only exception of the above rules. That is to say, in the block I/O structure, if
When BIO_read is called, a handshake occurs, and it also returns a retry request (calling BIO_should_r
Etry returns true ). In this case, the application can immediately re-execute the failed I/O operation, or
Set S
Send SMS messages and phone calls to Android virtual machines.
Android emulator already contains the gsm module, which can be used to simulate telephone and text message debugging (you don't have to spend too much money)
First, you must open the VM:
Emulator-avd XXXXXX-scale 0.8
Needless to say, the first parameter is the avd name and the second parameter is the display size.
Then use:
Telnet localhost
Port is the virtual machine port number, generally 5554 (you can use adb device
1.Closesocket (usually does not close immediately and goes through the time_wait process) and wants to continue to reuse the socket:Bool breuseaddr = true;Setsockopt(S, sol_socket, so_reuseaddr, (const char *) breuseaddr, sizeof (bool ));
2.If you want to force close a soket that is already in the connection status after you call closesocketTime_wait process:Bool bdontlinger = false;Setsockopt(S, sol_socket, so_dontlinger, (const char *) bdontling
{Echo socket_strerror ();Exit;}// Detect the content of the buffer zone. If there is any content, it will be sent. If there is no content, it will not be sent.If ($ buffer! = ""){Printf ("something is in the buffer... sending data... \ r \ n ");Socket_write ($ connection, $ buffer. ";"); // send the buffer content to the clientPrintf ("wrote to socket \ r \ n ");} Else{Printf ("no data in the buffer \ r \ n ");}// Obtain the input data from the client and put the read data into the buffer zoneW
confused. It seems that the read address is related to the socket handle, so although different newsocket has the same read address, however, data is read.
The client knows the server address in advance, which is the write address of the client. In a connect () request, connect () implicitly binds a local address to the client as the read address, and displays the bound server address as the sending Address. The server accepts the request and obtains the client address as the write address. In
;SetSockOpt (S,sol_socket, SO_REUSEADDR, (const char*) breuseaddr,sizeof (BOOL));2. Assume that a soket that is already in the connected state is forced to close after calling Closesocket and does not experience the TIME_WAIT process:BOOL Bdontlinger = FALSE;SetSockOpt (S,sol_socket,so_dontlinger, (const char*) bdontlinger,sizeof (BOOL));3. In the Send (), recv () process sometimes due to network conditions and other reasons, the collection can not be
significantly, we will either wait too long for the restart, or wait for a short period of time and bear the risk of some failures.
Because Gunicorn contains a Python hook pointing to the application, it is entirely possible to write a short piece of code to notify the restart process when the worker process is ready. Gunicorn does not contain the required hooks, but it is easy to make changes. It requires some modifications before the new version is released.
Now, restarting processes has take
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:
[email protected]
and provide relevant evidence. A staff member will contact you within 5 working days.