parameters: (self, server, port, nickname, password=None, username=None,
                  ircname=None, localaddress="", localport=0, ssl=False, ipv6=False)
return_statement: return self
docstring: Connect/reconnect to a server.
  
          Arguments:
  
              server -- Server name.
  
              port -- Port number.
  
              nickname -- The nickname.
  
              password -- Password (if any).
  
              username -- The username.
  
              ircname -- The IRC name ("realname").
  
              localaddress -- Bind the connection to a specific local IP address.
  
              localport -- Bind the connection to a specific local port.
  
              ssl -- Enable support for ssl.
  
              ipv6 -- Enable support for ipv6.
  
          This function can be called to reconnect a closed connection.
  
          Returns the ServerConnection object.
docstring_summary: Connect/reconnect to a server.
docstring_tokens: Connect / reconnect to a server .
function: def connect(self, server, port, nickname, password=None, username=None,
                  ircname=None, localaddress="", localport=0, ssl=False, ipv6=False):
          """Connect/reconnect to a server.
  
          Arguments:
  
              server -- Server name.
  
              port -- Port number.
  
              nickname -- The nickname.
  
              password -- Password (if any).
  
              username -- The username.
  
              ircname -- The IRC name ("realname").
  
              localaddress -- Bind the connection to a specific local IP address.
  
              localport -- Bind the connection to a specific local port.
  
              ssl -- Enable support for ssl.
  
              ipv6 -- Enable support for ipv6.
  
          This function can be called to reconnect a closed connection.
  
          Returns the ServerConnection object.
          """
          if self.connected:
              self.disconnect("Changing servers")
  
          self.previous_buffer = ""
          self.handlers = {}
          self.real_server_name = ""
          self.real_nickname = nickname
          self.server = server
          self.port = port
          self.nickname = nickname
          self.username = username or nickname
          self.ircname = ircname or nickname
          self.password = password
          self.localaddress = localaddress
          self.localport = localport
          self.localhost = socket.gethostname()
          if ipv6:
              self.socket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
          else:
              self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
          try:
              self.socket.bind((self.localaddress, self.localport))
              self.socket.connect((self.server, self.port))
              if ssl:
                  self.ssl = socket.ssl(self.socket)
          except socket.error, x:
              self.socket.close()
              self.socket = None
              raise ServerConnectionError, "Couldn't connect to socket: %s" % x
          self.connected = 1
          if self.irclibobj.fn_to_add_socket:
              self.irclibobj.fn_to_add_socket(self.socket)
  
          # Log on...
          if self.password:
              self.pass_(self.password)
          self.nick(self.nickname)
          self.user(self.username, self.ircname)
          return self
function_tokens: def connect ( self , server , port , nickname , password = None , username = None , ircname = None , localaddress = "" , localport = 0 , ssl = False , ipv6 = False ) : if self . connected : self . disconnect ( "Changing servers" ) self . previous_buffer = "" self . handlers = { } self . real_server_name = "" self . real_nickname = nickname self . server = server self . port = port self . nickname = nickname self . username = username or nickname self . ircname = ircname or nickname self . password = password self . localaddress = localaddress self . localport = localport self . localhost = socket . gethostname ( ) if ipv6 : self . socket = socket . socket ( socket . AF_INET6 , socket . SOCK_STREAM ) else : self . socket = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) try : self . socket . bind ( ( self . localaddress , self . localport ) ) self . socket . connect ( ( self . server , self . port ) ) if ssl : self . ssl = socket . ssl ( self . socket ) except socket . error , x : self . socket . close ( ) self . socket = None raise ServerConnectionError , "Couldn't connect to socket: %s" % x self . connected = 1 if self . irclibobj . fn_to_add_socket : self . irclibobj . fn_to_add_socket ( self . socket ) # Log on... if self . password : self . pass_ ( self . password ) self . nick ( self . nickname ) self . user ( self . username , self . ircname ) return self