Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8900603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:08:14+00:00 2026-06-15T01:08:14+00:00

How can I make the login part in QuickFIX in c++? I found tons

  • 0

How can I make the login part in QuickFIX in c++?
I found tons of tutorials and articles on how to do this on c# or java, but nothing on c++.

I have a server (acceptor), and a client (initiator). The username and password of the client are stored in the settings file, and are hardcoded in the server program.

From what I’ve read in the client I set the username and password in fromAdmin() and read and check the in the server in the toAdmin(), but how do I do that?

Here’s what I’ve tried so far:

  • cast the message to a FIX44::Logon& object using:

    FIX44::Logon& logon_message = dynamic_cast<FIX44::Logon&>(message);
    
  • Set the Username and password to the logon object like this:

    if(session_settings.has("Username"))
    {
        FIX::Username username = session_settings.getString("Username");
        logon_message.set(username);
    }
    
  • And send the message like this:

    FIX::Message messageToSend = logon_message;
    FIX::Session::sendToTarget(messageToSend);
    

But I get this error on the cast:

cannot dynamic_cast 'message' (of type 'class FIX::Message') to type 'struct FIX44::Logon&' (target is not pointer or reference to complete type)

What I’ve tried I got inspired from http://niki.code-karma.com/2011/01/quickfix-logon-support-for-username-password/comment-page-1/.

I’m still not clear on how to make the client and the server.

Can anyone help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:08:15+00:00Added an answer on June 15, 2026 at 1:08 am

    Possible mistakes:

    1. I think you have fromAdmin()/toAdmin() backward. toAdmin() is called on outgoing admin messages, fromAdmin() is called on incoming. For the Initiator, you must set the fields within the toAdmin() callback. Your Acceptor will check the user/pass in fromAdmin().

    2. Are you trying to dynamic_cast without first checking to see if it was a Logon message? The toAdmin() callback handles all admin messages; the message could be a Heartbeat, Logon, Logout, etc. That might explain your cast error.

    As to what the code should look like, my C++ is rusty, but the basic pattern is this:

    void YourMessageCracker::toAdmin( FIX::Message& message, const FIX::SessionID& sessionID)
    {
        if (FIX::MsgType_Logon == message.getHeader().getField(FIX::FIELD::MsgType))
        {
            FIX44::Logon& logon_message = dynamic_cast<FIX44::Logon&>(message);
            logon_message.setField(FIX::Username("my_username"));
            logon_message.setField(FIX::Password("my_password"));
        }
    }
    

    From there, I think you can see how you’d write a similar fromAdmin() where you’d get the fields instead of setting them.

    The above uses hard-coded user/pass, but you probably want to pull it from the config file. I think your calls to session_settings.getString(str) are correct for that.

    (Please forgive any coding errors. I’m much more fluent in the Java/C# versions of the QF engine, though the basic principles are the same.)

    I see that your first web reference uses the FIELD_GET_REF macro. It may be better than message.getHeader().getField(), but I’m not familiar with it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just wondering how I can make my app open automatically at login, but make
I have an issue. We have a website, where person can login and make
Anyone know how I can make a login button in Ruby on Rails for
I have to make a simple site which you can log in and out
I can make a single row IKImageBrowserView by setting the [imageBrowser setContentResizingMask:NSViewWidthSizable]; but in
I can make batch or vbs file on windows and run. this can automate
Here's my file. I want to make it redirect, but nothing happens. To check
I have been trying to make a secure login for my site that I
This question will make you think :D. I have a HTML input form with
Probably this is often problem, but I can't solve it. I need to automaticallly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.