#!/usr/bin/python3
# -*- coding: utf-8 -*-
import socket,sys
import time
start_time=time.time()
messages = [ b'This is the message. ',
             b'It will be sent ',
             b'in parts.',
             ]
server_address = ('192.168.1.161', 9999)
sockets=[socket.socket(socket.AF_INET,socket.SOCK_STREAM) for i in range(10000)]
# s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
# s.connect(server_address)
print(sys.stderr,'connecting to %s port %s' % server_address)
for sock in sockets:
    sock.connect(server_address)

for message in messages:

    # Send messages on both sockets
    for s in sockets:
        print (sys.stderr, '%s: sending "%s"' % (s.getsockname(), message))
        s.send(message)

    # Read responses on both sockets
    for s in sockets:
        data = s.recv(1024)
        print (sys.stderr, '%s: received "%s"' % (s.getsockname(), data))
        if not data:
            print (sys.stderr, 'closing socket', s.getsockname())

print("\033[32;1m时间为：%s\033[0"%(time.time()-start_time))
27c59dee70d3c710c2f8913796e1e8d688b65918
<mask token>

<mask token>
print(sys.stderr, 'connecting to %s port %s' % server_address)
for sock in sockets:
    sock.connect(server_address)
for message in messages:
    for s in sockets:
        print(sys.stderr, '%s: sending "%s"' % (s.getsockname(), message))
        s.send(message)
    for s in sockets:
        data = s.recv(1024)
        print(sys.stderr, '%s: received "%s"' % (s.getsockname(), data))
        if not data:
            print(sys.stderr, 'closing socket', s.getsockname())
print('\x1b[32;1m时间为：%s\x1b[0' % (time.time() - start_time))

<mask token>
start_time = time.time()
messages = [b'This is the message. ', b'It will be sent ', b'in parts.']
server_address = '192.168.1.161', 9999
sockets = [socket.socket(socket.AF_INET, socket.SOCK_STREAM) for i in range
    (10000)]
print(sys.stderr, 'connecting to %s port %s' % server_address)
for sock in sockets:
    sock.connect(server_address)
for message in messages:
    for s in sockets:
        print(sys.stderr, '%s: sending "%s"' % (s.getsockname(), message))
        s.send(message)
    for s in sockets:
        data = s.recv(1024)
        print(sys.stderr, '%s: received "%s"' % (s.getsockname(), data))
        if not data:
            print(sys.stderr, 'closing socket', s.getsockname())
print('\x1b[32;1m时间为：%s\x1b[0' % (time.time() - start_time))

import socket, sys
import time
start_time = time.time()
messages = [b'This is the message. ', b'It will be sent ', b'in parts.']
server_address = '192.168.1.161', 9999
sockets = [socket.socket(socket.AF_INET, socket.SOCK_STREAM) for i in range
    (10000)]
print(sys.stderr, 'connecting to %s port %s' % server_address)
for sock in sockets:
    sock.connect(server_address)
for message in messages:
    for s in sockets:
        print(sys.stderr, '%s: sending "%s"' % (s.getsockname(), message))
        s.send(message)
    for s in sockets:
        data = s.recv(1024)
        print(sys.stderr, '%s: received "%s"' % (s.getsockname(), data))
        if not data:
            print(sys.stderr, 'closing socket', s.getsockname())
print('\x1b[32;1m时间为：%s\x1b[0' % (time.time() - start_time))

#!/usr/bin/python3
# -*- coding: utf-8 -*-
import socket,sys
import time
start_time=time.time()
messages = [ b'This is the message. ',
             b'It will be sent ',
             b'in parts.',
             ]
server_address = ('192.168.1.161', 9999)
sockets=[socket.socket(socket.AF_INET,socket.SOCK_STREAM) for i in range(10000)]
# s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
# s.connect(server_address)
print(sys.stderr,'connecting to %s port %s' % server_address)
for sock in sockets:
    sock.connect(server_address)

for message in messages:

    # Send messages on both sockets
    for s in sockets:
        print (sys.stderr, '%s: sending "%s"' % (s.getsockname(), message))
        s.send(message)

    # Read responses on both sockets
    for s in sockets:
        data = s.recv(1024)
        print (sys.stderr, '%s: received "%s"' % (s.getsockname(), data))
        if not data:
            print (sys.stderr, 'closing socket', s.getsockname())

print("\033[32;1m时间为：%s\033[0"%(time.time()-start_time))