python 'TypeError: argument must be string or read-only character buffer, not tuple'
Question: I wrote this code using python 2.7:

    
    
    class LoadBalancerHandler:
    
        def __init__(self, file_name):
            self.server_socket = socket.socket(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
            file = open(file_name)
            setup_apps(file.read())
    
        def listen(self, host='localhost', port=80):
            self.server_socket.bind((host,port))
            self.server_socket.listen(5)
            while True:
                (client_socket, address) = self.server_socket.accept()
                threadHandling = ThreadHandling(client_socket, self)
                threadHandling.start()
    

but I get this error:

> TypeError: argument must be string or read-only character buffer, not tuple

This error is raised by the line:`self.server_socket.bind((host,port))`


Answer: Again, i think your options to socket.socket(...) are incorrect. If you're
trying to create a TCP listener, this works

    
    
    import socket
    s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    s.bind(('localhost',5555))
    s.listen(5)
    

