从NSE服务器解码数据包 [英] Decode a Packet from NSE Server

查看:97
本文介绍了从NSE服务器解码数据包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有



我正在制作自己的应用程序来接收来自NSE服务器的数据包,我很成功。但我的问题是所有数据包都是字节格式。现在我如何获得任何公司(scrips)的实时报价来解码这些数据包。当我将这些字节存储在文本文件中时,它看起来像:

? YZ ** 123 @



如何从中获取实时信息。

我成功映射到结构

Dear all

I am making my own application to receive packet from NSE sever and i am success in it. But my problem is all the packets is in byte format. now how can I get LIVE quotes of any company(scrips)to decode these packets. When I store these bytes in text file it looks like :
 YZ**123 @

How can I get Live feed from this .
I successfully map to the structure

Struct {
CHAR cNetId [2]
SHORT iNoPackets
CHAR cPackData [534]
} BcastPackData



我得到的iNoPackets值是256,但我无法用cPackData bcz映射我的字节数组长度是512 。请帮助我..


and i got iNoPackets value is 256, but i can't map with cPackData bcz my byte array length is 512. pls help me..

推荐答案

您必须将数据与源格式对齐。您必须注意NSE数据宽度和字节顺序并复制它自己的每个部分,因为它看起来像你使用2字节字符和NSE 1字节字符,
you must align your data to the source format. You must pay attention to the NSE data width and byte order and copy each part of it own, because it looks like you use 2-byte chars and the NSE 1 byte chars,


数字您收到的数据包为256(1个数据包)意味着您必须使用ntohs(iNopackts)转换为网络字节顺序。之后根据数据包计数,您可以使用lzo算法进行解压缩。然后通过提供偏移值来获取您的广播消息。
the number of packets you received as 256 ( 1 packet ) means you have to convert into the network byte order by using ntohs(iNopackts). After that based on the packet count, you decompress with the lzo algorithm. then get your broadcast message by providing the offset values.


这篇关于从NSE服务器解码数据包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆