
python
Davenny
O ever youthful,O ever weeping.
展开
-
multiprocessing_Manager().Queue()_Pool
This code is to realize copy multiple files in one file to the other file by Pool in multiprocessing ,to reduce the time.import time from multiprocessing import Pool,Manager import os def copyFileTask(原创 2017-09-22 22:39:39 · 3602 阅读 · 1 评论 -
async in multiprocess_pool
from multiprocessing import Pool import time import osdef test(): print('---the process in pool---pid = %d,ppid = %d---'%(os.getpid(),os.getppid())) for i in range(3): print('---%d -- '原创 2017-09-25 21:27:44 · 365 阅读 · 0 评论 -
udp_socket with thread to contect with each other
from threading import Thread from socket import *def sendinfo(): while True: sendinfo = input('<<') udpSocket.sendto(sendinfo.encode('utf-8'),adress)def recvinfo(): while True:原创 2017-09-27 17:57:23 · 495 阅读 · 0 评论 -
TCP_client and server in py
The client:from socket import *clientscoket = socket(AF_INET,SOCK_STREAM) clientscoket.bind(("",4568)) clientscoket.connect(("your IP",port)) clientscoket.send(b"hahha") recvData = clientscoket.recv(10原创 2017-09-28 15:03:30 · 380 阅读 · 0 评论 -
Different types Server in Python
multiprocess(The almost same as threading)from socket import * from multiprocessing import * from time import sleepdef dealWithClient(newsocket,cAddr): while True: recvData = newsocket.recv转载 2017-10-01 17:52:11 · 486 阅读 · 0 评论 -
Web static server
from socket import * from multiprocessing import Process import redef fun(client_socket): documentRoot = './Html' client_data = client_socket.recv(1024) client_data_lines = client_data.split原创 2017-10-03 15:40:35 · 503 阅读 · 0 评论 -
simple dynamic web server with self defined framework (python)
The framework import time from test1 import HTTPServerclass Applicatoin(object): def __init__(self,urls): self.urls = urls def __call__(self, evn, start_response): path = evn.get原创 2017-10-05 23:09:32 · 442 阅读 · 0 评论