Question

My situation is: A c++ program needs to talk with a Java program using FIX protocol.

My solution: - Messaging: C++ program publishes a text in FIX format which Java progrma can consume and parse with quickfix/j. - Socket: Setup a FIX server in Java program, then C++ program as a client can connect to this socket and write byte stream into it using quickfix. Java program uses quickfix/j to parse the byte stream.

My questions: 1. Is there any compatiblity problem for socket solution, i.e. ,the byte stream coded with quickfix can be fully decoded by quickfix/j? 2. Which one is better? Cons and pros.

Thanks in advance.

Was it helpful?

Solution

FIX messaging would be an easier solution, rather than implementing sockets. There are socket communications already embedded in the quickfix libraries. It is no use to reimplement then unless you are doing something very different. The engine is meant to decipher FIX messages. And if you want to modify any of the socket communications for the libraries, you can change the libraries itself. You have the source code anyways.

If you try implementing sockets you may have to write wrappers around the sockets to parse messages from C++ along to Java and vice versa.

You have the C++ version of quickfix library. Use that as a initiator to send FIX messages across to the Java acceptor. You probably wouldn't have to worry about writing a C++ server to send FIX messages in a bytestream. Let the underlying library do the work of doing the communication rather than yourself.

OTHER TIPS

FIX might be easier. But if you choose sockets, make sure to convert data send/recv from/on the C++ program to/from network byte order. (See reference for: htons(), htonl() ntohs(), and ntohl()). Java always uses network byte order so you don't have to do any conversion there.

FIX is a text based protocol, i.e. you don't have to worry about byte order. At the wire level, all you're doing is sending buffers of characters. So if you're writing in a C++ program to a java (quickfixj) based client/server, as long as you adhere to the FIX protocol, you'll have no issues.

Then again, as DumbCoder pointed out above, if you're not overly concerned about performance, you could use quickfix (the C++ version!)

Fix engines are written in a way they can communicate with other party fix engine. Language or platform of the two parties does not matter. You caan simply use JAVA version for one and C++ version for the other party.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top