import socket
import logging
import time

logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s '
                    '[%(levelname)s] (%(threadName)-10s) %(message)s',)


def client(string):
    HOST, PORT = 'localhost', 12345
    # SOCK_STREAM == a TCP socket
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    # sock.setblocking(0)  # optional non-blocking
    sock.connect((HOST, PORT))
    sock.send(string)
    reply = sock.recv(16384)  # limit reply to 16K
    logging.debug(reply)
    sock.close()
    return reply

if __name__ == "__main__":
    client("test bang #1")
    time.sleep(1)
    client("test bang #2")
    time.sleep(1)
    client("test bang #3")
    time.sleep(1)
    client("test bang #4")
    time.sleep(1)
    client("test bang #5")
    time.sleep(1)
    client("test bang #6")

import socket
import logging
import time

logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s '
                    '[%(levelname)s] (%(threadName)-10s) %(message)s',)


def client(string):
    HOST, PORT = 'localhost', 12345
    # SOCK_STREAM == a TCP socket
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    # sock.setblocking(0)  # optional non-blocking
    sock.connect((HOST, PORT))
    sock.send(string)
    reply = sock.recv(16384)  # limit reply to 16K
    logging.debug(reply)
    sock.close()
    return reply

if __name__ == "__main__":
    client("test bang #1")
    time.sleep(1)
    client("test bang #2")
    time.sleep(1)
    client("test bang #3")
    time.sleep(1)
    client("test bang #4")
    time.sleep(1)
    client("test bang #5")
    time.sleep(1)
    client("test bang #6")

# SOCK_STREAM == a TCP socket # sock.setblocking(0)  # optional non-blocking # limit reply to 16K #1") #2") #3") #4") #5") #6")