connect (Irc::Socket)

    # File lib/rbot/ircsocket.rb, line 290
        def connect
          if connected?
            warning "reconnecting while connected"
            return
          end
          srv_uri = @server_list[@conn_count % @server_list.size].dup
          srv_uri = 'irc://' + srv_uri if !(srv_uri =~ /:\/\//)
          @conn_count += 1
          @server_uri = URI.parse(srv_uri)
          @server_uri.port = 6667 if !@server_uri.port
          debug "connection attempt \##{@conn_count} (#{@server_uri.host}:#{@server_uri.port})"

          if(@host)
            begin
              sock=TCPSocket.new(@server_uri.host, @server_uri.port, @host)
            rescue ArgumentError => e
              error "Your version of ruby does not support binding to a "
              error "specific local address, please upgrade if you wish "
              error "to use HOST = foo"
              error "(this option has been disabled in order to continue)"
              sock=TCPSocket.new(@server_uri.host, @server_uri.port)
            end
          else
            sock=TCPSocket.new(@server_uri.host, @server_uri.port)
          end
          if(@ssl)
            require 'openssl'
            ssl_context = OpenSSL::SSL::SSLContext.new()
            ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
            sock = OpenSSL::SSL::SSLSocket.new(sock, ssl_context)
            sock.sync_close = true
            sock.connect
          end
          @sock = sock
          @last_send = Time.new
          @flood_send = Time.new
          @burst = 0
          @sock.extend(MonitorMixin)
          @sendq = MessageQueue.new
          @qthread = Thread.new { writer_loop }
        end