[Quickfix-developers] Question about Logon to server with username and password
Brought to you by:
orenmnero
|
From: Cheng S. <che...@gm...> - 2019-10-16 17:51:08
|
Hi All,
I am using the tradeClient example coming from the quickfix download. I can
run the initiator successfully. Now I need to logon to the remote
server/broker with requirement of username and password.
After reading a lot of questions and answers on this mailist, my
understanding is that I have to provide information of username and
password inside the function of toAdmin().
In the Application.cpp, there is already toApp() function. So I wrote my
own toAdmin() function as below. But the VC++ studio gave me the error:
function 'void Applcation:toAdmin(FIX:: :Message& message, const
FIX::SessionID& sessionID) already has a body.
I have two questions here:
1. why I got such an error? I tried putting the code inside toApp()
function, but it couldn't connect to the server.
2. Is my implementation of providing username and password correct?
Any reply will be highly appreciated!
--
Best regards
Shanbao
The below is the code inside the "Application.cpp".
void Application::toAdmin(FIX::Message& message, const FIX::SessionID&
sessionID)
{
try
{
//SenderSubID and compony ID
message.getHeader().setField(50, "107225");
message.getHeader().setField(115, "QUOTES");
//Username&Password
message.setField(553, "107225");
message.setField(554, "12345");
}
catch (FIX::FieldNotFound&) {}
std::cout << std::endl
<< "toAdmin OUT: " << message << std::endl;
}
|