摘要:
import threading from threading import Thread, Lock import time ticket = 50 lock_obj = Lock() def sale_ticket(): global ticket for i in range(100): lo 阅读全文
摘要:
服务端: from socket import socket, AF_INET, SOCK_DGRAM recv_socket = socket(AF_INET, SOCK_DGRAM) recv_socket.bind(('127.0.0.1', 8888)) while True: data, 阅读全文
摘要:
服务端代码: from socket import socket, AF_INET, SOCK_STREAM # 1. 创建socket对象 AF_INET:用于internet之间的进程通信,SOCK_STREAM:表示TCP协议 server_socket = socket(AF_INET, S 阅读全文