PHP Socket server building and testing
1.socket server building ideas
1) Objective: to understand the working mechanism of socket server
2) Idea: create socket - > Add socket to connection pool - > process receiving information - > handshake action - > send information
2.socket server code
Note: copy to php file, direct command line can run, no other support is requi ...
Posted by jdiver on Fri, 03 Jan 2020 23:13:03 -0800
How to solve the problem of nginx shock group
For nginx's swarm alarm problem, we first need to understand that during the startup of nginx, the master process will listen to each port specified in the configuration file, and then the master process will call the fork() method to create each subprocess. According to the working principle of the process, the subprocess will inherit all the ...
Posted by jandrews3 on Fri, 03 Jan 2020 02:43:55 -0800
Handwritten MQ Framework - combing with netty transformation
1. Background
Copy above Handwritten MQ Framework (3) - Client Implementation , which previously implemented mq as a server and client via the web, now plans to use netty to transform it.A while ago, I learned how to use netty (https://www.w3cschool.cn/netty4userguide/52ki1iey.html).There are probably some ideas.
netty encapsulates the use of s ...
Posted by iankent on Thu, 02 Jan 2020 16:10:04 -0800
Python builds a simple server
Python dynamic server web page (WSGI interface is required). The basic implementation steps are as follows: 1. Wait for the client's link, and the server will receive an http protocol request datagram 2. Use regular expression to parse the request datagram (request mode, environment for extracting files) 3. After extracting the file environment ...
Posted by nonlinear on Wed, 01 Jan 2020 06:52:42 -0800
Implement RPC service call framework by yourself
Reprint
RPC of TCP
Introduction
In this paper, a simple rpc call framework is implemented by using socket programming of java. It is composed of two projects named batchake provider (service provider) and batchake consumer (service caller).
The design idea is as follows:
1. In the battery cake provider, write a service called battery cake serv ...
Posted by wiggst3r on Wed, 01 Jan 2020 00:37:47 -0800
Python note day36 (concurrent) | multiprocess, join(), daemons, locking
1. Multi process
import os
import time
from multiprocessing import Process
def func(args,args2):
print(args,args2)
time.sleep(3)
print('Child process :', os.getpid())
print('Parent of child process :', os.getppid())
print(12345)
if __name__ == '__main__':
p = Process(target=func,args=('parameter','Pa ...
Posted by hoffmeister on Tue, 31 Dec 2019 18:35:05 -0800
TCP port scanner
A TCP port scanner based on Python 3
Principle: TCP connection with different ports means that the port is open if the connection is successful, and closed if the connection is not successful.
import socket
import re
import threading
import time
lock = threading.Lock()
threads = list()
ports_list = list()
def judge_hos ...
Posted by om.bitsian on Tue, 31 Dec 2019 11:48:12 -0800
Centos7 supervisor installation and configuration
Background
#
Two, installation
1. Install Python setuptools
yum install python-setuptools
#After the installation of supervisor, three executors will be generated: Supervisor TD, supervisor CTL and echo supervisor conf. they are the supervisor's daemons service (for receiving process management commands), the clien ...
Posted by ict on Tue, 31 Dec 2019 04:00:30 -0800
Basic concepts of Netty
Boot
BossGroup and WorkerGroup: the former is responsible for receiving client connections, and the latter is responsible for network reading and writing. All types are NioEventLoopGroup
NioEventLoopGroup is equivalent to an event loop group, which contains multiple event loops. Each event loop is NioEventLoop
NioEventLoop refers to a thr ...
Posted by jaco on Fri, 27 Dec 2019 11:43:42 -0800
How to use Workman to make a chat room
1: First, let's talk about the installation of thinkphp+workerman.
Install thinkp5.1
composer create-project topthink/think=5.1.x-dev tp5andworkman
Install think worker
My official group Click here.
composer require workerman/workerman
2: Let's first look at the code of think worker
config/worker_server.php
Let's start with an example o ...
Posted by richmlpdx on Thu, 26 Dec 2019 05:40:52 -0800