I’ve been trying to use QuickFIX to setup a client. It’s the example from the QuickFIX site, as follows:
int main( int argc, char** argv ) {
try
{
if(argc < 2) return 1;
std::string fileName = argv[1];
FIX::SessionSettings settings(fileName);
Handler application;
FIX::FileStoreFactory storeFactory(settings);
FIX::FileLogFactory logFactory(settings);
FIX::SocketInitiator initiator(application, storeFactory, settings, logFactory /*optional*/);
initiator.start();
cout << "Started.\n";
initiator.block();
cout << "Stopped.\n";
return 0;
}
catch(FIX::ConfigError& e)
{
std::cout << e.what();
return 1;
}
}
And I defined the Handler implementing the Application class.
And the config file looks like below:
# default settings for sessions
[DEFAULT]
ConnectionType=initiator
ReconnectInterval=60
SenderCompID=CLIENT
FileLogPath=.
FileStorePath=.
DataDictionary=D:\Program Files\quickfix\spec\FIX44.xml
# session definition
[SESSION]
# inherit ConnectionType, ReconnectInterval and SenderCompID from default
BeginString=FIX.4.4
TargetCompID=SERVER
HeartBtInt=30
SocketConnectPort=6523
SocketConnectHost=127.0.0.1
StartTime=8:00:00
EndTime=23:00:00
When running, the Handler::toAdmin and Handler::onCreate got called, then the block function blocks. But using the small FIX application Mini-FIX as the server, I could not get any incoming message from the program. I have tried opening two Mini-FIX, one as a server, one as a client, and they communicate just fine. And I have made sure that the ID’s and listening port are correct. So what would be the problem? Mini-FIX should have received the toAdmin Message 8=FIX.4.4|9=55|35=5|34=1|49=CLIENT|52=20120702-08:29:25.334|56=SERVER|10=115 sent by the program.
Tthe start time and endtime seems strange, but the toAdmin actually got called. So I assume the message should have already sent.
Edit
I solved the problem already after I made several changes to the config file and the program, but I am not quite sure what caused it. Consider this closed.
The problem has gone, after I manipulated the config file and the Mini-FIX.
It seems that it was caused by several reasons:
The time should be set in the interval.
Mini-FIX which acts as server should set the targetcomputerid correctly.
initiator.block()is enough for starting the engine and waiting. No need to runstart()andblock()both.