python(mutlti conn socket client)

import socket
import sys

messages = [ b'This is the message. ',
 b'It will be sent ',
 b'in parts.',
server_address = ('', 9998)

# Create a TCP/IP socket
socks = [ socket.socket(socket.AF_INET, socket.SOCK_STREAM) for i in range(11000)]
# Connect the socket to the port where the server is listening
print('connecting to %s port %s' % server_address)
for s in socks:

for message in messages:

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

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

HOST = 'localhost'  # The remote host
PORT = 9998  # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
while True:
    msg = bytes(input(">>:"), encoding="utf8")
    data = s.recv(1024)

    print('Received', data)