FIX 通信模型 - 消息传递或套接字

发布于 2024-09-27 09:51:47 字数 364 浏览 1 评论 0原文

我的情况是:C++程序需要使用FIX协议与Java程序进行通信。

我的解决方案: - 消息传递:C++ 程序以 FIX 格式发布文本,Java 程序可以使用 Quickfix/j 来使用和解析该文本。 - Socket:在Java程序中设置一个FIX服务器,然后C++程序作为客户端可以连接到该套接字并使用quickfix将字节流写入其中。 Java程序使用quickfix/j来解析字节流。

我的问题: 1、socket方案是否存在兼容性问题,即quickfix编码的字节流可以被quickfix/j完全解码? 2. 哪一个更好?缺点和优点。

提前致谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

三寸金莲 2024-10-04 09:51:47

FIX 消息传递将是一个更简单的解决方案,而不是实现套接字。 Quickfix 库中已经嵌入了套接字通信。除非你正在做一些非常不同的事情,否则重新实现是没有用的。该引擎旨在破译 FIX 消息。如果您想修改库的任何套接字通信,您可以更改库本身。无论如何,你有源代码。

如果您尝试实现套接字,您可能必须在套接字周围编写包装器,以将消息从 C++ 解析为 Java,反之亦然。

您有 Quickfix 库的 C++ 版本。使用它作为发起者将 FIX 消息发送到 Java 接受者。您可能不必担心编写 C++ 服务器来以字节流发送 FIX 消息。让底层库来做通信的工作,而不是你自己。

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.

眼前雾蒙蒙 2024-10-04 09:51:47

修复可能会更容易。但如果您选择套接字,请确保将 C++ 程序上的数据发送/接收转换为网络字节顺序。 (请参阅参考资料:htons()htonl()ntohs()ntohl())。 Java 始终使用网络字节顺序,因此您不必在那里进行任何转换。

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.

饮惑 2024-10-04 09:51:47

FIX 是基于文本的协议,即您不必担心字节顺序。在线路级别,您所做的就是发送字符缓冲区。因此,如果您使用 C++ 程序编写基于 java (quickfixj) 的客户端/服务器,只要遵守 FIX 协议,就不会有任何问题。

话又说回来,正如 DumbCoder 上面指出的,如果你不太关心性能,你可以使用quickfix(C++ 版本!)

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!)

软糖 2024-10-04 09:51:47

修复引擎的编写方式可以与其他方修复引擎进行通信。
双方的语言或平台并不重要。
您可以简单地为一方使用 JAVA 版本,为另一方使用 C++ 版本。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文