Click here to Skip to main content
15,878,945 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 .
Some things are clear But Pls tell me more clear. As per Documentation the first char is 4 and I am receiving same. Now Second char is 32, Third is 0, fourth is 1, fifth is 0,sixth is 0, seventh is 4 and so on... Now can u tell me how do I twiddled it to know this is compressed or not. I am not asking u about code. Just tell me how I twiddled it.
If anybody know pls help me?

Thanks and regards
Raghvendra kumar Roy
Posted
Comments
Goutam Patra 10-Dec-10 1:42am    
What you have asked for just a beginin. You have to go a long way to get the actual data. Actually you are not trying. Try youself. Map those structures as per the document. thats all i can help you.

1 solution

Twiddling involves reversing a given number of bytes such that the byte in ‘n’ position comes to the first position; the byte in (n-1) position comes to the second position and so on. For example, if the value to be sent is 1A2B (hexadecimal), reverse the bytes to 2B1A. The same applies while receiving messages. So if the value received is 02BC, the actual value is BC02. So twiddle such data types before sending and after receiving to ensure that correct data is sent and received.

Now your Third byte is 0, fourth byte is 1. If you copy those bytes into a byte array say "a" and convert it to Int16 using BitConverter.ToInt16(a, 0) and see the result will be 256. Now reverse the byte array (change the position of the array element ie first element in the second place and second in the first place) and again use BitConverter.ToInt16(a, 0), Now it will return 1. And thats the actual value. That mean it contain Only Packet.

You have to do it (reverse the byte array) for all numeric values and get the values.
 
Share this answer
 
Comments
Raghvendra Kumar Roy 10-Dec-10 1:07am    
Dear Gautam
That all thing is Right. I am tellimg you more clearly. When I receiving Data then it tells that packet contains 434 bytes. Look message is::
Received 434 bytes on Friday, December 10, 2010: at 11:32:38 AM

02 00 02 4E 53 45 46 4F 00 00 00 00 00 00 7B 8E 00 00 01 00 66 DD 02 00 C9 04 00 00 2B 00 1B 03 00 00 E8 03 00 00 AA 69 33 3A 77 04 00 00 01 00 00 00 D6 06 00 00 D3 04 00 00 02 00 00 00 FA 00 00 00 97 04 00 00 01 00 00 00 FA 00 00 00 83 04 00 00 01 00 00 00 FA 00 00 00 7E 04 00 00 01 00 00 00 FA 00 00 00 65 04 00 00 01 00 00 00 D6 06 00 00 00 05 00 00 01 00 00 00 EE 02 00 00 14 05 00 00 03 00 00 00 FA 00 00 00 23 05 00 00 01 00 00 00 F4 01 00 00 28 05 00 00 02 00 00 00 F4 01 00 00 2D 05 00 00 02 00 00 00 1B 03 00 00 F3 02 00 00 6E 05 00 00 DF 02 00 00 53 2B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 CF DC 40 00 00 00 00 40 9B E5 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
These are in Hexadecimal that I convert it. Now If I twiddle it then it contains only 0. How I solve or decode this? Pls Help me.
rahulpokharkar 26-Feb-16 7:56am    
Hi Raghvendra,

I have same problem in twiddling can you tell me how you solve this issue.
dewang123 5-Apr-19 0:40am    
Do you have a working solution for this?
neo100894 21-Apr-23 7:07am    
I too need working solution of this

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900