# File lib/em-socksify/socks5.rb, line 15
      def socks_send_connect_request
        @socks_state = :connecting

        send_data [5, 1, 0].pack('CCC')

        if matches = @socks_target_host.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/)
          send_data "\x01" + matches.to_a[1 .. -1].map { |s| s.to_i }.pack('CCCC')

        elsif @socks_target_host =~ /^[:0-9a-f]+$/
          raise SOCKSError, 'TCP/IPv6 over SOCKS is not yet supported (inet_pton missing in Ruby & not supported by Tor)'

        else
          send_data [3, @socks_target_host.size, @socks_target_host].pack('CCA*')
        end

        send_data [@socks_target_port].pack('n')
      end